Jump to content

Using Variables with HTML Forms


danik69

Recommended Posts

Hi

 

I am having a major problem with trying to get the HTML value attribute to display the a value stored in a array from SQL Query.

 

So i have done an SQL query then outputted it all to the screen, but i cant set the  value attribute on my HTML form to the variable $Name.

 

Can anyone please tell me where i am going wrong?

 

Thanks Nick

 



while($nt=mysql_fetch_array($result)){
echo "$nt[photo_url] $nt[Name] $nt[Education] $nt[skills] $nt[Aboutme] <br>";     // name class and mark will be printed with one line break at the end
}


$Photo_url = $_POST["photo_url"];
$Name = $_POST["Name"];
$Education = $_POST["Education"];
$Skills= $_POST["Skills"];
$Aboutme = $_POST["Aboutme"];
?>



<form method="post" action="updateaboutme.php">
Photo Url:<input type="text" size="12" maxlength="12" name="Photo_url" value="<?php echo $nt['Name'] ?>" <br /> 


<input type="submit" value="submit" name="submit">
</form> 

Link to comment
Share on other sites

You're also missing the closing semicolon in the php within the value attribute of the input tag.  And I believe you should have quotes around the array keys in the second line.  Also, not going to break anything, but you should use <br /> instead of <br>

 

And of course, like the poster above said, you need to end your input tag with "/>"

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.