944,141 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 840
  • PHP RSS
You are currently viewing page 1 of this multi-page discussion thread
Oct 27th, 2009
-3

PHP syntax error - unexpected T_STRING in /net/home/z6zhou/public_html/signup.php on

Expand Post »
Hi,

I got the syntax error in my following php code:
unexpected T_STRING in /net/home/z6zhou/public_html/signup.php on line 1. Who can help it out?

my php code is as follows:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">


<head><title>Publication DB</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta http-equiv="Content-Language" content="en-us" />
<link rel="stylesheet" href="style.css" type="text/css" />

<link href="/stylesheets/snippets.css?1239220407" media="screen" rel="Stylesheet" type="text/css" />
<link href="/stylesheets/minitabs.css?1229957682" media="screen" rel="Stylesheet" type="text/css" />


<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>

<script type="text/javascript">
_uacct = "UA-2557640-1";
urchinTracker();
</script>

</head>


//<body bgcolor =" 000000" TEXT="cccccc" LINK =" ff99ff" VLINK =" ff8888" ALINK =" 884488">

<body background ="ice-light.jpg" TEXT="black">



// create an acount code starting

<div id="container">

<script type="text/javascript">
//<![CDATA[
function validate_login(frm) {
var value = '';
var errFlag = new Array();
var _qfGroups = {};
_qfMsg = '';

value = frm.elements['username'].value;
if (value == '' && !errFlag['username']) {
errFlag['username'] = true;
_qfMsg = _qfMsg + '\n - login cannot be empty';
}

value = frm.elements['password'].value;
if (value == '' && !errFlag['password']) {
errFlag['password'] = true;
_qfMsg = _qfMsg + '\n - password cannot be empty';
}

value = frm.elements['email'].value;
var regex = /^((\"[^\"\f\n\r\t\v\b]+\")|([\w\!\#\$\%\&'\*\+\-\~\/\^\`\|\{\}]+(\.[\w\!\#\$\%\&'\*\+\-\~\/\^\`\|\{\}]+)*))@((\[(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((2
5[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\])|(((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9
]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\-])+\.)+[A-Z
a-z\-]+))$/;
if (value != '' && !regex.test(value) && !errFlag['email']) {
errFlag['email'] = true;
_qfMsg = _qfMsg + '\n - invalid email address';
}

if (_qfMsg != '') {
_qfMsg = 'Invalid information entered.' + _qfMsg;
_qfMsg = _qfMsg + '\nPlease correct these fields.';
alert(_qfMsg);
return false;
}
return true;
}
// ]]>
</script>

<form id="su_form" method="POST" action="/~z6zhou/signup.php" name="login" onsubmit="try { var myValidator = validate_login; } catch(e) { return true; } return myValidator(this);
">
<p><label for="login" class="signup">Desired Username</label><br/>
<input id="user_username" name="user[username]" size="30" type="text" /></p>

<p><label for="email" class="signup">Email</label><br/>

<input id="user_email" name="user[email]" size="30" type="text" onkeypress="su_check_email();" /></p>

<p><label for="email" class="signup">Real name</label><br/>
<input id="user_realname" name="user[realname]" size="30" type="text" /></p>

<p><label for="email" class="signup">Your URL <em>(optional)</em></label><br/>
<input id="user_url" name="user[url]" size="30" type="text" /></p>

<p><label for="password" class="signup">Password</label><br/>
<input id="user_plainpassword" name="user[plainpassword]" size="30" type="password" onkeypress="su_check_passwd();" onblur="su_check_passwd();" /></p>

<p><label for="password" class="signup">Confirm Password</label><br/>

<input id="user_plainpassword_confirmation" name="user[plainpassword_confirmation]" size="30" type="password" onkeypress="su_check_passwd();" onblur="su_check_passwd();" /></p>

<p><input name="commit" type="submit" value="Sign up" /></p>
<p><input name="redirect" type="hidden" value="/~z6zhou/signup.php" /></p>
</form>

<br style="clear: both" />

<div id="footer">
<p>Copyright &copy; 2009 <a href=" "> </a></p>

// Site Meter
<p><a href=" "><img src="sea.jpg" width="120" height="30" border="0" alt=""/></a></p>

</div>

</div>
<script src="/javascripts/prototype.js?1229957682" type="text/javascript"></script>
<script src="/javascripts/effects.js?1229957682" type="text/javascript"></script>

<script src="/javascripts/dragdrop.js?1229957682" type="text/javascript"></script>
<script src="/javascripts/controls.js?1229957682" type="text/javascript"></script>
<script src="/javascripts/general.js?1229957682" type="text/javascript"></script>

// end of creating an acount code

</body>
</html>
Reputation Points: 9
Solved Threads: 0
Newbie Poster
zhou1919 is offline Offline
10 posts
since Oct 2009
Oct 27th, 2009
0
Re: PHP syntax error - unexpected T_STRING in /net/home/z6zhou/public_html/signup.php on
Use code tags. It really hard to follow your code.

There is 0 php in the code you posted. The only reason you are getting the error is because you have short_tags enabled.

PHP Syntax (Toggle Plain Text)
  1. <?xml version="1.0" encoding="utf-8"?>
causes an error because <? is the opening (short) tag for php.
Replace it with:
PHP Syntax (Toggle Plain Text)
  1. <?php echo '<?xml version="1.0" encoding="utf-8"?>'; ?>
Reputation Points: 235
Solved Threads: 193
Nearly a Posting Virtuoso
kkeith29 is offline Offline
1,315 posts
since Jun 2007
Oct 27th, 2009
0
Re: PHP syntax error - unexpected T_STRING in /net/home/z6zhou/public_html/signup.php on
The error is solved. Thanks. My php code is to create an online account for signing up in my homepage. But it doesn't work. Could you tell me the reasons?
Reputation Points: 9
Solved Threads: 0
Newbie Poster
zhou1919 is offline Offline
10 posts
since Oct 2009
Oct 27th, 2009
0
Re: PHP syntax error - unexpected T_STRING in /net/home/z6zhou/public_html/signup.php on
You need to post the code.
Reputation Points: 235
Solved Threads: 193
Nearly a Posting Virtuoso
kkeith29 is offline Offline
1,315 posts
since Jun 2007
Oct 27th, 2009
-1
Re: PHP syntax error - unexpected T_STRING in /net/home/z6zhou/public_html/signup.php on
My following php code is to create an online account for signing up in my homepage. But it doesn't work. Could you tell me the reasons?

---
<?php echo '<?xml version="1.0" encoding="utf-8"?>'; ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">


<head><title>Publication DB</title><meta http-equiv="Content-Type" content="text
/html; charset=utf-8" /><meta http-equiv="Content-Language" content="en-us" />
<link rel="stylesheet" href="style.css" type="text/css" />

<link href="/stylesheets/snippets.css?1239220407" media="screen" rel="Stylesheet
" type="text/css" />
<link href="/stylesheets/minitabs.css?1229957682" media="screen" rel="Stylesheet
" type="text/css" />


<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>

<script type="text/javascript">
_uacct = "UA-2557640-1";
urchinTracker();
</script>

</head>



<body background ="ice-light.jpg" TEXT="black">




<div id="container">

<script type="text/javascript">
//<![CDATA[
function validate_login(frm) {
var value = '';
var errFlag = new Array();
var _qfGroups = {};
_qfMsg = '';

value = frm.elements['username'].value;
if (value == '' && !errFlag['username']) {
errFlag['username'] = true;
_qfMsg = _qfMsg + '\n - login cannot be empty';
}

value = frm.elements['password'].value;
if (value == '' && !errFlag['password']) {
errFlag['password'] = true;
_qfMsg = _qfMsg + '\n - password cannot be empty';
}

value = frm.elements['email'].value;
var regex = /^((\"[^\"\f\n\r\t\v\b]+\")|([\w\!\#\$\%\&'\*\+\-\~\/\^\`\|\{\}]+(
\.[\w\!\#\$\%\&'\*\+\-\~\/\^\`\|\{\}]+)*))@((\[(((25[0-5])|(2[0-4][0-9])|([0-1]?
[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4]
[0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\])|(
((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[
0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][
0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\-])+\.)+[A-Za-z\-]+))$/;
if (value != '' && !regex.test(value) && !errFlag['email']) {
errFlag['email'] = true;
_qfMsg = _qfMsg + '\n - invalid email address';
}

if (_qfMsg != '') {
_qfMsg = 'Invalid information entered.' + _qfMsg;
_qfMsg = _qfMsg + '\nPlease correct these fields.';
alert(_qfMsg);
return false;
}
return true;
}
// ]]>
</script>

<form id="su_form" method="POST" action="/~z6zhou/signup.php" name="login" onsub
mit="try { var myValidator = validate_login; } catch(e) { return true; } return
myValidator(this);">
<p><label for="login" class="signup">Desired Username</label><br/>
<input id="user_username" name="user[username]" size="30" type="text" /></p>

<p><label for="email" class="signup">Email</label><br/>

<input id="user_email" name="user[email]" size="30" type="text" onkeypress="su_c
heck_email();" /></p>

<p><label for="email" class="signup">Real name</label><br/>
<input id="user_realname" name="user[realname]" size="30" type="text" /></p>

<p><label for="email" class="signup">Your URL <em>(optional)</em></label><br/>
<input id="user_url" name="user[url]" size="30" type="text" /></p>

<p><label for="password" class="signup">Password</label><br/>
<input id="user_plainpassword" name="user[plainpassword]" size="30" type="passwo
rd" onkeypress="su_check_passwd();" onblur="su_check_passwd();" /></p>

<p><label for="password" class="signup">Confirm Password</label><br/>

<input id="user_plainpassword_confirmation" name="user[plainpassword_confirmatio
n]" size="30" type="password" onkeypress="su_check_passwd();" onblur="su_check_p
asswd();" /></p>

<p><input name="commit" type="submit" value="Sign up" /></p>
<p><input name="redirect" type="hidden" value="/~z6zhou/signup.php" /></p>
</form>

<br style="clear: both" />

<div id="footer">
<p>Copyright &copy; 2009 <a href=" "> </a></p>

<p><a href=" "><img src="sea.jpg" width="120" height="30" border="0" a
lt=""/></a></p>

</div>

</div>
<script src="/javascripts/prototype.js?1229957682" type="text/javascript"></scri
pt>
<script src="/javascripts/effects.js?1229957682" type="text/javascript"></script
>

<script src="/javascripts/dragdrop.js?1229957682" type="text/javascript"></scrip
t>
<script src="/javascripts/controls.js?1229957682" type="text/javascript"></scrip
t>
<script src="/javascripts/general.js?1229957682" type="text/javascript"></script
>

</body>
</html>
Reputation Points: 9
Solved Threads: 0
Newbie Poster
zhou1919 is offline Offline
10 posts
since Oct 2009
Oct 27th, 2009
0
Re: PHP syntax error - unexpected T_STRING in /net/home/z6zhou/public_html/signup.php on
Thats not php. Its html and javascript.
Reputation Points: 235
Solved Threads: 193
Nearly a Posting Virtuoso
kkeith29 is offline Offline
1,315 posts
since Jun 2007
Oct 27th, 2009
0
Re: PHP syntax error - unexpected T_STRING in /net/home/z6zhou/public_html/signup.php on
Click to Expand / Collapse  Quote originally posted by zhou1919 ...
But it doesn't work. Could you tell me the reasons?
Hey.

Sadly, the fact that the code doesn't work doesn't exactly help us debug it. Nor does posting the part of your PHP code that isn't actually PHP ;-)

Please explain why/how it isn't working, what you have tried to fix it, and why it failed. And, of course, any and all error messages you get.

We aren't here to debug the code for you. We are here to help you debug it.
Reputation Points: 93
Solved Threads: 70
Posting Pro
Atli is offline Offline
526 posts
since May 2007
Oct 27th, 2009
0
Re: PHP syntax error - unexpected T_STRING in /net/home/z6zhou/public_html/signup.php on
Could you tell me how to change my following html code into php code?
Thanks.

----
<?php echo '<?xml version="1.0" encoding="utf-8"?>'; ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">


<head><title>Publication DB</title><meta http-equiv="Content-Type" content="text
/html; charset=utf-8" /><meta http-equiv="Content-Language" content="en-us" />
<link rel="stylesheet" href="style.css" type="text/css" />

<link href="/stylesheets/snippets.css?1239220407" media="screen" rel="Stylesheet
" type="text/css" />
<link href="/stylesheets/minitabs.css?1229957682" media="screen" rel="Stylesheet
" type="text/css" />


<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>

<script type="text/javascript">
_uacct = "UA-2557640-1";
urchinTracker();
</script>

</head>



<body background ="ice-light.jpg" TEXT="black">




<div id="container">

<script type="text/javascript">
//<![CDATA[
function validate_login(frm) {
var value = '';
var errFlag = new Array();
var _qfGroups = {};
_qfMsg = '';

value = frm.elements['username'].value;
if (value == '' && !errFlag['username']) {
errFlag['username'] = true;
_qfMsg = _qfMsg + '\n - login cannot be empty';
}

value = frm.elements['password'].value;
if (value == '' && !errFlag['password']) {
errFlag['password'] = true;
_qfMsg = _qfMsg + '\n - password cannot be empty';
}

value = frm.elements['email'].value;
var regex = /^((\"[^\"\f\n\r\t\v\b]+\")|([\w\!\#\$\%\&'\*\+\-\~\/\^\`\|\{\}]+(
\.[\w\!\#\$\%\&'\*\+\-\~\/\^\`\|\{\}]+)*))@((\[(((25[0-5])|(2[0-4][0-9])|([0-1]?
[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4]
[0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9])))\])|(
((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[
0-9]?[0-9]))\.((25[0-5])|(2[0-4][0-9])|([0-1]?[0-9]?[0-9]))\.((25[0-5])|(2[0-4][
0-9])|([0-1]?[0-9]?[0-9])))|((([A-Za-z0-9\-])+\.)+[A-Za-z\-]+))$/;
if (value != '' && !regex.test(value) && !errFlag['email']) {
errFlag['email'] = true;
_qfMsg = _qfMsg + '\n - invalid email address';
}

if (_qfMsg != '') {
_qfMsg = 'Invalid information entered.' + _qfMsg;
_qfMsg = _qfMsg + '\nPlease correct these fields.';
alert(_qfMsg);
return false;
}
return true;
}
// ]]>
</script>

<form id="su_form" method="POST" action="/~z6zhou/signup.php" name="login" onsub
mit="try { var myValidator = validate_login; } catch(e) { return true; } return
myValidator(this);">
<p><label for="login" class="signup">Desired Username</label><br/>
<input id="user_username" name="user[username]" size="30" type="text" /></p>

<p><label for="email" class="signup">Email</label><br/>

<input id="user_email" name="user[email]" size="30" type="text" onkeypress="su_c
heck_email();" /></p>

<p><label for="email" class="signup">Real name</label><br/>
<input id="user_realname" name="user[realname]" size="30" type="text" /></p>

<p><label for="email" class="signup">Your URL <em>(optional)</em></label><br/>
<input id="user_url" name="user[url]" size="30" type="text" /></p>

<p><label for="password" class="signup">Password</label><br/>
<input id="user_plainpassword" name="user[plainpassword]" size="30" type="passwo
rd" onkeypress="su_check_passwd();" onblur="su_check_passwd();" /></p>

<p><label for="password" class="signup">Confirm Password</label><br/>

<input id="user_plainpassword_confirmation" name="user[plainpassword_confirmatio
n]" size="30" type="password" onkeypress="su_check_passwd();" onblur="su_check_p
asswd();" /></p>

<p><input name="commit" type="submit" value="Sign up" /></p>
<p><input name="redirect" type="hidden" value="/~z6zhou/signup.php" /></p>
</form>

<br style="clear: both" />

<div id="footer">
<p>Copyright &copy; 2009 <a href=" "> </a></p>

<p><a href=" "><img src="sea.jpg" width="120" height="30" border="0" a
lt=""/></a></p>

</div>

</div>
<script src="/javascripts/prototype.js?1229957682" type="text/javascript"></scri
pt>
<script src="/javascripts/effects.js?1229957682" type="text/javascript"></script
>

<script src="/javascripts/dragdrop.js?1229957682" type="text/javascript"></scrip
t>
<script src="/javascripts/controls.js?1229957682" type="text/javascript"></scrip
t>
<script src="/javascripts/general.js?1229957682" type="text/javascript"></script
>


</body>
</html>
Reputation Points: 9
Solved Threads: 0
Newbie Poster
zhou1919 is offline Offline
10 posts
since Oct 2009
Oct 27th, 2009
0
Re: PHP syntax error - unexpected T_STRING in /net/home/z6zhou/public_html/signup.php on
I tried to create an online account for signing up in my homepage by php code. But my code seems html and not php. My question is how to change my html code into php and make my online sign up account work. My homepage is
http://www.bioinformatics.uwaterloo....hou/signup.php
Please take a look at the source code and tell me why it doesn't work. Thanks a lot.
Reputation Points: 9
Solved Threads: 0
Newbie Poster
zhou1919 is offline Offline
10 posts
since Oct 2009
Oct 27th, 2009
0
Re: PHP syntax error - unexpected T_STRING in /net/home/z6zhou/public_html/signup.php on
Search online for registration scripts, there are lots of them.

We will not write your code for you, go research it and ask specific questions when something doesn't work.

Use code tags, its easy. Highlight the code and click the Code button...

Also, why the hell do you have a >2MB jpg image on the page? Waste of bandwidth there.
Reputation Points: 96
Solved Threads: 124
Master Poster
Will Gresham is offline Offline
728 posts
since May 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Different resolution affect view of the system
Next Thread in PHP Forum Timeline: How to run a web search query in blog page when loaded





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC