Jump to content

Simple coding Problem


derek412

Recommended Posts

I have this code i'm trying to modify:

print "<form action=authenticate.php method=post name=login onsubmit=\"return saveme();\">Username: <input type=text name=username><br>
Password: <input type=password name=password><br>
Remember me?<br />
<input type=\"radio\" value=\"ON\" name=\"save\">Yes <input type=\"radio\" name=\"save\" value=\"OFF\" checked>No
<input type=submit value=Submit></form></fieldset></td></tr></table><br> 
<h3><a href='register.php'>REGISTER NOW!</a></h3><br />   <-------------- This line, I assume, needs to be deleted/changed
<i><center><a href=Game Copyright ©{$year} {$set['game_owner']}.</center></i>";
print <<<OUT

 

The line pointed out, I want to insert a clickable graphic in there. The trouble is, whenever I do, I get an error:

Parse error: syntax error, unexpected T_STRING in that line.

The line I inserted in place of the line above is correct, according to HTML conventions:

<a href="register.php" img src="joinbutton.jpg"></a><br/>

but I get that error, no matter how I change it.

 

Am I doing something wrong?

Link to comment
https://forums.phpfreaks.com/topic/195495-simple-coding-problem/
Share on other sites

The line I inserted in place of the line above is correct, according to HTML conventions:

<a href="register.php" img src="joinbutton.jpg"></a><br/>

yea, the anchor tag and your image tag are two separate things.  the way you had it, the image location was an attribute to the anchor tag, which isn't a valid attribute. (guy who posted above me shows the correct syntax)

Here's the code now, still getting the same error in that changed line:

print "<form action=authenticate.php method=post name=login onsubmit=\"return saveme();\">Username: <input type=text name=username><br>
Password: <input type=password name=password><br>
Remember me?<br />
<input type=\"radio\" value=\"ON\" name=\"save\">Yes <input type=\"radio\" name=\"save\" value=\"OFF\" checked>No
<input type=submit value=Submit></form></fieldset></td></tr></table><br>
<a href="register.php"><img src="joinbutton.jpg"></a><br/>     <--------------------line error Parse error: syntax error, unexpected T_STRING
<i><center><a href=Game Design/Graphics/Concept copyright ©{$year} {$set['game_owner']}.</center></i>";
print <<<OUT

 

Could something else in the structure be causing this?

html attributes need quotes around the value.  example: <a href="this.php"></a> and you didn't have ANY lol.

 


echo '<form action="authenticate.php" method="post" name="login" onsubmit="return saveme();">Username: <input type="text" name="username"><br>
Password: <input type="password" name="password"><br>
Remember me?<br />
<input type="radio" value="ON" name="save">Yes <input type="radio" name="save" value="OFF" checked>No
<input type="submit" value="Submit"></form></fieldset></td></tr></table><br>
<a href="register.php"><img src="joinbutton.jpg"></a><br/>
<i><center><a href="Game Design/Graphics/Concept copyright ©' . $year . $set['game_owner'] . '</center></i>';
print <<<OUT

Solved....sorta. I'm not a PHP or HTML pro, but I know a few things, and boy this code seems very non-flexible.

 

Yet another snippet of code i'm trying to add an image to:

<!-- Begin Main Content -->
EOF;
$IP = ($_SERVER['HTTP_X_FORWARDED_FOR'])
    ?  $_SERVER['HTTP_X_FORWARDED_FOR']
    :  $_SERVER['REMOTE_ADDR'];
if(file_exists('ipbans/'.$IP))
{
die("<b><font color=red size=+1>Your IP has been banned, there is no way around this.</font></b></body></html>");
}
$year=date('Y');
print "<h3></h3>
<br>
<br>
<table width=120%>
<p><img src="frontscreenpanel.jpg" width="360" height="310" /></p>     <---------------this line here giving error
<td>
<fieldset>
<legend>Login</legend>";

 

Same error in the line pointed out: Parse error: syntax error, unexpected T_STRING crap. I would appreciate your insight.

same thing as last time, attribute values need to be in quotes

 

EOF;
$IP = ($_SERVER['HTTP_X_FORWARDED_FOR'])
    ?  $_SERVER['HTTP_X_FORWARDED_FOR']
    :  $_SERVER['REMOTE_ADDR'];
if(file_exists('ipbans/'.$IP))
{
die("<b><font color=\"red\" size=\"+1\">Your IP has been banned, there is no way around this.</font></b></body></html>");
}
$year = date('Y');
print '<h3></h3>
<br>
<br>
<table width="120%">
<p><img src="frontscreenpanel.jpg" width="360" height="310" /></p>
<td>
<fieldset>
<legend>Login</legend>';

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.