View Single Post
  #5 (permalink)  
Old Dec 17th, 2007, 22:41
hschmitz hschmitz is offline
Up'n'Coming Member
Join Date: Jun 2007
Location: Birmingham, UK
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Parse error-Need Help!

Hi dhossai,

I think alexgeek just missed one PHP variable in the HTML form.
The correct version should look like this


PHP: Select all

<?php
require "check.php";
// If member has logged in then below script will be execuated. 
// let us collect all data of the member 
$row=mysql_fetch_object(mysql_query("select * from tbl_login where userid='$_SESSION[userid]'"));
?>
<form action='update-profileck.php' method='post'/>
<input type=hidden name=todo value=update-profile>     
<fieldset>
<legend>Update Profile</legend>
<label for="LastName">Last Name</label>
<input id="LastName" name="LastName" value="<?php echo $row->Last_Name ?>" type="text"/><br/>
 
</fieldset>
</form>
<?php echo "<br/>Welcome $_SESSION[userid] <br/><br/>Click &nbsp;<a href=logout.php>here to logout</a> &nbsp; | &nbsp; <a href=change-password.php>Change Password</a>| &nbsp; <br/>";
?>
One important thing when programming PHP is that all the PHP code needs to be enclosed in the <?php ?> tags, while all the HTML code must be placed outside those tags. When outside the tags, you cannot use the PHP variables, so you have to open and close the PHP tags, whenever you want to produce dynamic content.

See how, in the last line, the echo command is used to generate HTML. This is how HTML is generated when inside the <?php ?> tags.

Btw also note that I've replaced the single quotes around the value field with double quotes.
Reply With Quote