Page 1 of 1

How do I autofill 1 field in my HTML form (form2email)

Posted: Tue Jun 07, 2011 3:46 pm
by Yiaggi
Hi guys,

I have a simple calculator on my website which has a few options selectable by radio buttons. When the user adds selections - the total price of their order is automatically calculated and displayed in a <div> for them to see. The client then can deselect options or add according to their budget.

The above is all dealt with by javascript such as:

<input type = "radio" name = "size" value = "0" onclick = "chkrads('myform', 'size')"><b>small</b>
<input type = "radio" name = "size" value = "1" onclick = "chkrads('myform', 'size')"><b>large</b>


and so on for all the other values .....

What I want is to include an HTML form which is controlled by the classic PHP Form2Email. I can do everything I have mentioned so far .........

What I want is to AUTOFILL one of the sections of the form titled "Quoted Price" with the value generated by the calculator.

My form would in theory look like this:

<form id="ContactForm" method="post" action="FormToEmail.php" class="input2">
<label>Package Name: <input name="name" type="text" id="name" value="" size="" maxlength="80" class="input"/></label>

<label>Items selected: <input name="email" type="text" id="email" value="" size="" maxlength="80" class="input"/></label>

<label>Price: <input name="QUOTED PRICE" type="text" id="QUOTED PRICE" value="" size="" maxlength="80" class="input"/></label>

<label>
<input type="submit" class="submit" name="submit" id="submit" value="submit"/>
</label>
</form>



I have been reliably informed that PHP is the correct way to solve this problem? My php is coming along but I am stumped with how to do this ... I have tried a few ways but it never works ....!

Anyone have a clue??

Cheers in advance guys!

Re: How do I autofill 1 field in my HTML form (form2email)

Posted: Tue Jun 07, 2011 4:35 pm
by Jonah Bron
To put a value into a form, just do this:

Code: Select all

<input type="text" name="name" value="<?php echo $value; ?>" />
Providing the value you want to output is called $value. You can put whatever you want though.