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

Link to comment
Share on other sites

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>

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.