Jump to content

[SOLVED] Displaying variables without nesting php tags


rawky1976

Recommended Posts

Hello all

 

I know you can't nest php tags so if you're already inside a code block and outputting a table via echo and want to popultate the value of a text box, how do you format the syntax?

 

$result = @mysql_query($query);

if (mysql_affected_rows() == 1){

$firstname = $result['user_fname'];

 

The above gets a row, I'm not sure if the last line is necessary, now in the form what goes between the VALUE attribute to make it display the data from the query?

 

echo "<tr><td>First Name</td><td><input type=\"text\" value=\"\" name=\"firstname\" id=\"firstname\" style=\"width: 160px\"/></td><td>Last Name</td><td> <input type=\"text\" value=\"$lastname\" name=\"lastname\" id=\"lastname\" style=\"width: 160px\"/></td></tr>";

 

I tried $firstname, $result['user_fname'], echo $firstname etc etc...?

 

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.