Jump to content

Large Form


phpretard

Recommended Posts

You could do

<?php
$fields = implode('~',$_POST);
?>

 

which would put all responses into the string $fields separated by the "~" character, but you would loose the field names.

 

If you tell us what you are trying to do, we might be able to help you.

 

Ken

Link to comment
https://forums.phpfreaks.com/topic/90200-large-form/#findComment-462531
Share on other sites

I am simple trying to submit a form and email the information from it.  I can do that no sweat.  I just know there must be a better way then to type $_post['info'] for every field.  I have about 40 fields.

 

This isn't detramental, I just would like to know if there is a better way.

 

Thanks a million!

 

-Anthony

Link to comment
https://forums.phpfreaks.com/topic/90200-large-form/#findComment-462621
Share on other sites

What the print_r() gives you is the raw information that comes from your form. The string between the "[]" is the name you've put in the "<input>" line of the form.

 

If you want to make it more meaningful you will have to do some more work.

 

Create an array with the correspondence between the field names and what you want. Something like:

<?php
$flds = array('fld1' => 'field one','c1name'=>'Customer 1 Name','fld3'=>'Field Three');
$bdy = array();
foreach ($flds as $nam => $val)
    $bdy[] = $val . ' = ' . $_POST[$fld];
$body = implode("\n",$bdy);
$to = '[email protected]';
$subject = 'Form filled in';
$headers = 'From: [email protected]';
mail($to, $subject, $body, $headers);
?>

 

Ken

Link to comment
https://forums.phpfreaks.com/topic/90200-large-form/#findComment-463290
Share on other sites

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.