Forum Moderators: coopster

Message Too Old, No Replies

radio box answer not coming through on email

Email form isn't picking up the users answer for a radio box

         

togethercomms

3:54 pm on Aug 20, 2009 (gmt 0)

10+ Year Member



Hi,

I recently asked for help using a php mail form, i have analysed it more closly and found thhat the radio box results are not being picked up by the form and thus not being sent through the email.

I have attached to this the code i have for the php form and the form data itself.

Many Thanks


php mail to form

<?php
$to = "someone@somewhere.co.uk";
$subject = "Contact form";
$message = "From: ".$_REQUEST['name']."

Reply E-mail: ".$_REQUEST['email']."

Telephone Number: ".$_REQUEST['tel']."

Current Job Title: ".$_REQUEST['jobtitle']."

Current Employer: ".$_REQUEST['employer']."

Does this person wish to be contacted: ".$_REQUEST['contact']."";
$headers = "From: someone@somewhere.com";
$sent = mail($to, $subject, $message, $headers) ;
if($sent) {

header("location: allinfo.php");
}
else
{print "We encountered an error sending your mail"; }
?>


html form

<form id="frm" method="post" action=" sendmail.php" onsubmit="return f(this);">
<span class="required">*</span><input onfocus="this.select()" type="text" name="name" id="name" class="firstname" value="Full Name"><br>
<br>
<input onfocus="this.select()" type="text" name="jobtitle" id="jobtitle" class="jobtitle" value="Current Job Title"><br><br>
<input onfocus="this.select()" type="text" name="employer" id="employer" class="employer" value="Current Employer"><br><br>
<span class="required1">*</span><input onfocus="this.select()" type="text" name="tel" id="tel" class="tel" value="Telephone Number"><br>
<br>
<span class="required2">*</span><input onfocus="this.select()" type="text" name="email" id="email" class="email" value="Email Address"><br>
<br>
I would like a Consultant to contact me for a conversation?<br>
<div class="radiobox"><input type="radio" id="yes" class="contact" value="Yes">Yes &nbsp; &nbsp; &nbsp; <input type="radio" id="no" class="contact" value="No">No<br>
<div class="error" id=nameError>You have not selected anything<br></div><br><br></div>
<input onfocus="this.select()" type="submit" name="submit" id="submit" class="submit" value="Submit Form">
</form>

your help is appreciated

Pico_Train

6:20 pm on Aug 20, 2009 (gmt 0)

10+ Year Member



<input type="radio" id="yes" class="contact" value="Yes">Yes &nbsp; &nbsp; &nbsp; <input type="radio" id="no" class="contact" value="No">

You seem to be missing the name="" part in the inputs, it should probably be

<input type="radio" name="contact" id="yes" class="contact" value="Yes">Yes &nbsp; &nbsp; &nbsp; <input type="radio" name="contact" id="no" class="contact" value="No">

If that doesn't work try name="contact[]" ...

$_POST['contact'] should then come through.

Good luck!