Note that there are some explanatory texts on larger screens.

plurals
  1. POcontact form not passing variables
    primarykey
    data
    text
    <p>I'm sure I'm just missing something really simple, because I'm burned out from coding. Can someone please spot what the problem is? When submitted the form emails the info, but none of the variables (like firstname, lastname, etc) are being included in the email.</p> <p>All I get is this:</p> <p>From:<br> Phone: -- Call Back:<br> Best time to call:<br> Message: </p> <p>If you can find what the problem is - I will be very thankful.</p> <p>Here is the form HTML:</p> <pre><code>&lt;form action="mail.php" method="POST" id="main_form" onSubmit="this.reset();"&gt; &lt;p&gt;First Name&lt;/p&gt; &lt;input type="text" name="firstname" size="93" style="width:475px; float:left;"&gt;&lt;br /&gt; &lt;p&gt;Last Name&lt;/p&gt; &lt;input type="text" name="lastname" size="93" style="width:475px; float:left;"&gt;&lt;br /&gt; &lt;p&gt;Email&lt;/p&gt; &lt;input type="text" name="email" size="93" style="width:475px; float:left;"&gt;&lt;br /&gt; &lt;p&gt;Confirm E-mail&lt;/p&gt; &lt;input type="text" name="confirmemail" size="93" style="width:475px; float:left;"&gt;&lt;br /&gt; &lt;p&gt;Contact Number&lt;br /&gt; &lt;input type = "text" id = "Ph1" name="Ph1" size =" 3" maxlength = "3" onkeyup = "validate(this,2)"&gt;- &lt;input type = "text" id = "Ph2" name="Ph2" size =" 3" maxlength = "3" onkeyup = "validate(this,3)"&gt;- &lt;input type = "text" id = "Ph3" name="Ph3" size =" 4" maxlength = "4" onkeyup = "validate(this,3)"&gt; &lt;/p&gt; &lt;script type = "text/javascript"&gt; function validate(which,next) { var val = which.value; val = val.replace(/[^0-9]/g,""); // strip non-digits which.value = val; next = "Ph" + next; if (val.length == 3) { // field completed document.getElementById(next).focus() } } &lt;/script&gt; &lt;p&gt;Request Phone Call:&lt;br /&gt; &lt;span style="font-family:'Open Sans', serif; font-size:14px;"&gt;Yes:&lt;/span&gt;&lt;input type="radio" value="Yes" name="call"&gt; &lt;span style="font-family:'Open Sans', serif; font-size:14px;"&gt;No:&lt;/span&gt;&lt;input type="radio" value="No" name="call"&gt;&lt;br /&gt; &lt;/p&gt; &lt;p&gt;Best time to contact:&lt;br /&gt; &lt;span style="font-family:'Open Sans', serif; font-size:14px;"&gt;Morning:&lt;input type="radio" value="Morning" name="calltime"&gt; &lt;span style="font-family:'Open Sans', serif; font-size:14px;"&gt;Afternoon:&lt;input type="radio" value="Afternoon" name="calltime"&gt; &lt;span style="font-family:'Open Sans', serif; font-size:14px;"&gt;Evening:&lt;input type="radio" value="Evening" name="calltime"&gt;&lt;br /&gt; &lt;/p&gt; &lt;p&gt;Message&lt;/p&gt;&lt;textarea name="message" rows="6" cols="67"&gt;&lt;/textarea&gt;&lt;br /&gt; &lt;input class = "_submit"type="submit" value="SUBMIT" style="width: 128px; height: 36px; font-family: 'Pathway Gothic One', serif; font-size: 28px; border-radius: 0px; border-width: 0px; color: #FFF; background-color: #FFCA04; float:left; margin-top: 10px;"&gt; &lt;/form&gt; </code></pre> <p>Here is the mail.php</p> <pre><code>&lt;?php $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $email = $_POST['email']; $confirmemail = $_POST['confirmemail']; $phone1 = $_POST['Ph1']; $phone2 = $_POST['Ph2']; $phone3 = $_POST['Ph3']; $call = $_POST['call']; $calltime = $_POST['calltime']; $message = $_POST['message']; $formcontent=" From: $firstname $lastname \n Phone: $phone1-$phone2-$phone3 \n Call Back: $call \n Best time to call: $calltime \n Message: $message"; $recipient = "MyEmail@domain.com"; $subject = "YOU HAVE A MESSAGE FROM WEBSITE CONTACT PAGE"; $mailheader = "From: $email \r\n"; mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); echo "Thank You!" . " -" . "&lt;a href='form.html' style='text-decoration:none;color:#ff0099;'&gt; Return Home&lt;/a&gt;"; ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload