Note that there are some explanatory texts on larger screens.

plurals
  1. POphp to form script? syntax error unexpected
    primarykey
    data
    text
    <p>Hi Can anyone suggest a quick form script for a php form? I generated the one below from telepro and modified the html and emails a bit, but I get this error for the checkbox</p> <p>Parse error: syntax error, unexpected '=' in /home/inn.co.uk/public/mailer.php on line 14 </p> <p>thanks for your help</p> <p>Regards Judi</p> <pre><code> &lt;form method="POST" action="contact.php"&gt; &lt;div class="form-field"&gt; &lt;input type="text" name="Name" onFocus="if(this.value=='Name')this.value='';" value="Name"&gt; &lt;/div&gt; &lt;div class="form-field"&gt; &lt;input type="text" name="Telephone" onFocus="if(this.value=='Telephone')this.value='';" value="Telephone"&gt; &lt;/div&gt; &lt;div class="form-field"&gt; &lt;input type="text" name="Timetocall" onFocus="if(this.value=='Time to call')this.value='';" value="Time to call"&gt; &lt;/div&gt; &lt;div class="form-field"&gt; &lt;ul class="tickboxes"&gt; &lt;li&gt;Do you agree to our&lt;br/&gt;&lt;a href="terms-and-conditions.html"&gt;Terms of Business &lt;/a&gt;&lt;input type="checkbox" name="DoyouagreetoourTermsofBusiness?" value="Yes" /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt; &lt;div class="button"&gt; &lt;input type="image" src="images/submit.jpg" value="" name="submit"&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <hr> <pre><code>&lt;?php // Website Contact Form Generator // http://www.tele-pro.co.uk/scripts/contact_form/ // This script is free to use as long as you // retain the credit link // get posted data into local variables $EmailFrom = "enquiry@inn.co.uk"; $EmailTo = "judith@yahoo.co.uk"; $Subject = "New enquiry"; $Name = Trim(stripslashes($_POST['Name'])); $Telephone = Trim(stripslashes($_POST['Telephone'])); $Timetocall = Trim(stripslashes($_POST['Timetocall'])); $DoyouagreetoourTermsofBusiness? = Trim(stripslashes($_POST['DoyouagreetoourTermsofBusiness?'])); // validation $validationOK=true; if (Trim($Name)=="") $validationOK=false; if (Trim($Telephone)=="") $validationOK=false; if (Trim($Timetocall)=="") $validationOK=false; if (Trim($DoyouagreetoourTermsofBusiness?)=="") $validationOK=false; if (!$validationOK) { print "&lt;meta http-equiv=\"refresh\" content=\"0;URL=error.htm\"&gt;"; exit; } // prepare email body text $Body = ""; $Body .= "Name: "; $Body .= $Name; $Body .= "\n"; $Body .= "Telephone: "; $Body .= $Telephone; $Body .= "\n"; $Body .= "Timetocall: "; $Body .= $Timetocall; $Body .= "\n"; $Body .= "DoyouagreetoourTermsofBusiness?: "; $Body .= $DoyouagreetoourTermsofBusiness?; $Body .= "\n"; // send email $success = mail($EmailTo, $Subject, $Body, "From: &lt;$EmailFrom&gt;"); // redirect to success page if ($success){ print "&lt;meta http-equiv=\"refresh\" content=\"0;URL=ok.htm\"&gt;"; } else{ print "&lt;meta http-equiv=\"refresh\" content=\"0;URL=error.htm\"&gt;"; } ?&gt; </code></pre>
    singulars
    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.
    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