Jump to content

Integrate Php into html form


ShaolinF

Recommended Posts

Hi guys,

 

I want to be able to use php values in my html forms. See below..

 

I have two php declarations, the first is called username and the value is contains is test. The second declaration is called pword and contains the value 12345.

 

What I want to do is to be-able to use the above two declarations in the following POST form:

 

 

<form name="form" method="post" action="contact_thanks.php"><p class="bodymd">Your Name<br><input type="text" name="Name"></p><p class="bodymd">Your Email<br><input type="text" name="Email"></p>   <input type="submit" name="Submit" value="Submit" /></p></form>

 

The php script and form are on the same page, and rather than the user having to type it out all over again I would rather the fields already be filled in. So if I can get the PHP values into the appropriate form text boxes that will save alot of time.

 

So any ideas ?

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/57300-integrate-php-into-html-form/
Share on other sites

I don't see any fields that contain a username or a password...

 

Here is what you do to fill in the values though...

<form name="form" method="post" action="contact_thanks.php">
<p class="bodymd">
Your Name<br><input type="text" name="Name" value="<?php echo USERNAME; ?>"></p>
<p class="bodymd">
Your Email<br><input type="text" name="Email" value="<?php echo PWORD; ?>"></p>   
<input type="submit" name="Submit" value="Submit" /></p>
</form>

Umm... not really sure what ur asking but i think ur trying to but variables into the text field, so if you want to do that just put <?php echo  $(your variable); ?> in the value.

 

<form name="form" method="post" action="contact_thanks.php">
<p class="bodymd">Your Name<br><input type="text" name="Name" value="<?php echo  $(your variable); ?>"></p><p class="bodymd">Your Email<br><input type="text" name="Email" value="<?php echo  $(your variable); ?>"></p>   <input type="submit" name="Submit" value="Submit" /></p></form>

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.