Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

form order question ...

Status
Not open for further replies.

fauntleroy

Technical User
May 21, 2008
46
US
Hi there .... I'm a designer and know very little of PHP. I've created a form via GoDaddy's webformailer.php "template" and it works!

it also send the information through the email in a table form ... and that's swell too.

My problem is, it's sending the responses in Alphbetical order .... not in the order that the questions are asked. So it presents the "address" first .... then "comments" .... etc ....

Address
xxxxx

comments
xxxxxx

Email
xxxxxx

Fax
xxxxx

First_Name
xxxxx

I'd like to recipient of the form info (client) to get the info in the order that the form is written. That would be, starting with the field "First_Name" .... then Last_Name .... and down the line.

Might it have something to do with the form_order value "alpha"?

Thanks for any help.


<form action="/webformmailer.php" method="post" name="Volunteer Form" id="Volunteer Form">
<div align="right">
<input type="hidden" name="subject" value="Volunteer" />
<input type="hidden" name="recipient" value="me@verizon.net" />
<input type="hidden" name="redirect" value="thankyou.html" />
</div>
<p align="right"><span class="bodytext">First Name:</span>
<input name="First_Name" type="text" id="First_Name" />
</p>
<p align="right"><span class="bodytext">Last Name:</span>
<input name="Last_Name" type="text" id="Last_Name" />
</p>
<p align="right"><span class="bodytext">Address:</span>
<textarea name="Address"></textarea></p>
<p align="right"><span class="bodytext">Phone:</span>
<input type="text" name="Phone" /></p>
<p align="right"><span class="bodytext">Fax:</span>
<input name="Fax" type="text" id="Fax" />
</p>
<p align="right"><span class="bodytext">E-Mail:</span>
<input name="Email" type="text" id="Email" />
</p>
<p align="right" class="bodytext">I would be interested in:</p>
<p align="right" class="bodytext">Placing a yard sign on my home or lawn
<label>
<input name="Placing a yard sign" type="checkbox" id="Placing a yard sign" value="yes" />
</label>
<label></label>
</p>
<p align="right" class="bodytext">Volunteering in the campaign headquarters
<label>
<input name="Volunteering in the campaign headquarters" type="checkbox" id="Volunteering in the campaign headquarters" value="yes" />
</label>
<label></label>
</p>
<p align="right" class="bodytext">Making phone calls
<label>
<input name="Making phone calls" type="checkbox" id="Making phone calls" value="yes" />
</label>
<label></label>
</p>
<p align="right" class="bodytext">Stuffing and labeling envelopes
<label>
<input name="Stuffing and labeling envelopes" type="checkbox" id="Stuffing and labeling envelopes" value="yes" />
</label>
<label></label>
</p>
<p align="right" class="bodytext">Hosting a coffee klatch so my neighbors
and friends can meet ED
<label>
<input name="Hosting a coffee klatch" type="checkbox" id="Hosting a coffee klatch" value="yes" />
</label>
</p>
<p align="right" class="bodytext">Working to get my neighbors, family, and
friends to vote for ED
<label>
<input name="Working to get my neighbors to vote" type="checkbox" id="Working to get my neighbors to vote " value="yes" />
</label>

<label> </label>
</p>
<p align="right" class="bodytext">Working at the polls
<label>
<input name="Working at the polls" type="checkbox" id="Working at the polls" value="yes" />
</label>
</p>
<p align="right" class="bodytext">Distributing literature
<label>
<input name="Distributing literature" type="checkbox" id="Distributing literature" value="yes" />
</label>
</p>
<p align="right"><span class="bodytext">Comments:
<textarea name="comments" cols="40" rows="10">
Type comments here.</textarea>
</span> </p>
<div align="right">
<input type="submit" name="submit" value="submit"/>
<input type="hidden" name="form_order" value="alpha"/> <input type="hidden" name="form_delivery" value="hourly"/> <input type="hidden" name="form_format" value="html"/> </form>

 
the easiest way to do this is as follows:

Code:
$fields = array('field1', 'field2' ... etc) ;//put these in the order which you wish to output them
$output = "<table>";
foreach ($fields as $field){
  $value = empty($_POST[$field]) ? '&nbsp;' : htmlentities($_POST[$field]);
  $output .= <<<HTML
<tr>
  <td>$field</td>
   <td $value</td>
</tr>
HTML;
}
//send $output by html mail (phpmailer)
 
Thanks for your response jp. Actually, I was able to change value="alpha" to value="default" on the html page below the form, and that did the trick...

<input type="submit" name="submit" value="submit"/>
<input type="hidden" name="form_order" value="default"/> <input type="hidden" name="form_delivery" value="hourly"/> <input type="hidden" name="form_format" value="html"/> </form></td>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top