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...?

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.