Email handler problem

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi folks,

I'm having problems with my PHP form handler. It used to work correctly, but  
now for some reason its not. I'm hoping someone here could take a look and  
tell me where I might have gone wrong.

Just for background info, when I click submit the form sends okay, but when  
the email arrives in my inbox the $name value is non-existent - like nothing  
had been entered in the box on the web page form.

Also, I'm not sure if this is relevant: The server uses PHP version 4.4.4

The form handler: (scripts/ct_em.php)

$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;

"NAME: $name \n\n
EMAIL ADDRESS: $email \n\n
"From: $email" );
header( "Location: THANK-YOU PAGE" );

The form: (03_contact.html) - it should be noted that I've got a Javascript  
validation script that checks the length of the value of the email address  
field to ensure that it's not left blank - it's had no impact on the form  
working or not working - when the form did work this Javascript was always  

<form enctype="multipart/form-data" method="post" action="scripts/ct_em.php"  

   <table width=288 cellpadding=0 cellspacing=0>
   <tr valign=center>
   <td class="body_mid" width=288>Name:<br><input name="name"  
style="font-size: 12px; width: 288px; height: 19px;"></td>
   <tr valign=center>
   <td width=288 height=5></td>
   <tr valign=center>
   <td class="body_mid" width=288>Email address:<br><input name="email"  
style="font-size: 12px; width: 288px; height: 19px;"></td>
   <tr valign=center>
   <td width=288 height=5></td>
   <tr valign=top>
   <td class="body_mid" width=288>Your message:<br><textarea name="message"  
style="font-family: Arial; font-size: 12px; width: 288px; height:  
   <tr valign=center>
   <td width=288 height=10></td>
   <tr valign=center>
   <td width=288><a href="javascript:document.form1.submit()"  
OnMouseOut="se.src='images/bu_se_dk.gif'" onClick="return validate();"><img  
name="se" id="se" src="images/bu_se_dk.gif" alt="Send" border="0"></a></td>


Thanks for your time folks!



Re: Email handler problem

Am Mon, 20 Nov 2006 21:59:18 GMT schrieb Danny Smith:

Quoted text here. Click to load it

Just try to set your $name variable before you use it :)
$name = $_REQUEST['name'] ;

Best Regards,
Fabian Fuchs

Re: Email handler problem

Danny Smith wrote:
Quoted text here. Click to load it


Add these two lines at the very top of your script, right after the
first <?php tag

    ini_set('display_errors', '1');

With this configuration, PHP will let you know when you try to use an
inexistent variable.

I (almost) never check the dodgeit address.
If you *really* need to mail me, use the address in the Reply-To
header with a message in *plain* *text* *without* *attachments*.

Site Timeline