PDA

View Full Version : sendresults.php


jumpuh
03-23-2009, 03:45 PM
Hello -

I am new at the forms sending and need some help. I have a form with name, fax, phone, email and message. I fill out the form and hit submit but when it comes to my email all it says is results from form: but their are no results.

Please help? This is supposed to go live in the next day.

mangofreak
03-23-2009, 05:58 PM
Check this link http://www.php-scripts.com/php_diary/122899.php3

davidj
03-23-2009, 08:16 PM
post your code please

jumpuh
03-23-2009, 10:18 PM
Thanks:
Here's the code:
// Your email address. This is where the form information will be sent.
$emailadd = 'denised@rhematek.net';

// Where to redirect after form is processed.
$url = 'http://www.m-mltd.com/index.html';

// Makes all fields required. If set to '1' no field can not be empty. If set to '0' any or all fields can be empty.
$req = '1';

// --------------------------Do not edit below this line--------------------------
$text = "Results from form:\n\n";
$space = ' ';
$line = '
';
foreach ($_POST as $key => $value)
{
if ($req == '1')
{
if ($value == '')
{echo "$key is empty";die;}
}
$j = strlen($key);
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;}
$j = 20 - $j;
for ($i = 1; $i <= $j; $i++)
{$space .= ' ';}
$value = str_replace('\n', "$line", $value);
$conc = "{$key}:$space{$value}$line";
$text .= $conc;
$space = ' ';
}
mail($emailadd, $subject, $text, 'From: '.$emailadd.'');
echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">';
?>


The fields I am trying to pull from are: name, fax, phone, email and message.

I appreciate all help with this.

edbr
03-24-2009, 02:55 AM
idont like this bit
if ($j >= 20)
{echo "Name of form element $key cannot be longer than 20 characters";die;} 20 characters is a very short message

jumpuh
03-25-2009, 06:50 PM
I can bump up the ($j >= 20) but... why isn't it pulling info from any of the fields?
Name, fax, phone, email and message?? Nothing comes back in the sent mail?

Thanks

edbr
03-27-2009, 03:12 AM
i would first try collecting the form elements to see if they are being passed
so <?php $name = $_POST['name'];
$email = $_POST['email'];
$fax = $_POST['fax];

echo $name $email $fax ; ?>

jumpuh
03-27-2009, 03:32 AM
Thanks for the help but can you please give me a little bit more direction. This is all too new to me.

To I add this:
so <?php $name = $_POST['name'];
$email = $_POST['email'];
$fax = $_POST['fax];

echo $name $email $fax ; ?>

To my form somewhere? or in place of my current form?

Thanks

edbr
03-27-2009, 03:45 AM
no on the action page (sendmail ) if the values are being passed then they will be printed its just a debugging step.
your script is collecting values as key so it should pass them but if the echo produces nothing then it is a problem with your form

BTW where it says $_POST['name'] this must be the same 'name' as the form element and values are being passed method=" POST"

jumpuh
03-27-2009, 04:16 AM
I have no doubt it's my form. This is the first form I've done. I modified the message part of the form (by accident) and now get this in my email.

Results from form:

textarea: this should do the trick

It did not pull the rest of the fields??

edbr
03-27-2009, 04:23 AM
post your form code

jumpuh
03-27-2009, 04:23 AM
Got it!!
Results from form:

Your_Name:: Bugsbee
Your_Fax:: 508-867-5309
Your_Phone:: 508-867-5310
Email:: username@yahoo.com
Message:: this should do it



Awesome. Thanks for your help!!

jumpuh
03-27-2009, 04:27 AM
edbr -

You were an awesome help!! Thanks!!

Can you help me with my other post? Why does my code look different in two different browsers? What can I do to fix it?

edbr
03-27-2009, 04:33 AM
again the answer will be code. are you using tables? , in your thread post a link and we can see the problem there