473,385 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Syntax error: unexpected '!'

I'm getting this error code on my website when trying to submit the new form I've uploaded.

Parse error: syntax error, unexpected '!' in /www/zymichost.com/m/y/c/mycustombuiltpc/htdocs/CustomForm.php on line 31

Line 31 is !isset($_POST['Role']) ||
Oct 25 '11 #1
23 2773
zorgi
431 Expert 256MB
Can you give more code ... that looks just like a part of some if statement ... or is it?
Oct 25 '11 #2
Hi, it's from this section of the PHP
Expand|Select|Wrap|Line Numbers
  1. // validation expected data exists
  2.     if(!isset($_POST['first_name']) ||
  3.         !isset($_POST['last_name']) ||
  4.         !isset($_POST['email']) ||
  5.         !isset($_POST['comments'])
  6.         !isset($_POST['Role']) ||
  7.         !isset($_POST['RAM']) ||
  8.         !isset($_POST['RAID']) ||
  9.         !isset($_POST['HDD1']) ||
  10.         !isset($_POST['HDD2']) ||
  11.         !isset($_POST['OS']) ||
  12.         !isset($_POST['Extras']) ||
  13.         !isset($_POST['Accessories']) ||
  14.         !isset($_POST['Guarantee']) ||
  15.         !isset($_POST['customer']) ||
  16.         !isset($_POST['budget'])) {
  17.         died('We are sorry, but there appears to be a problem with the form you submitted.');
Oct 25 '11 #3
zorgi
431 Expert 256MB
Expand|Select|Wrap|Line Numbers
  1. !isset($_POST['comments'])
  2.  
should probably be

Expand|Select|Wrap|Line Numbers
  1. !isset($_POST['comments']) ||
  2.  
Oct 25 '11 #4
Ok, thanks for the help, I'll try it asap
Oct 25 '11 #5
This is the current code. When the form is submitted i get the defined error message (from this code) on screen. Any suggestions as to how to fix this?
Expand|Select|Wrap|Line Numbers
  1.  
  2. // validation expected data exists
  3.     if(!isset($_POST['first_name']) ||
  4.         !isset($_POST['last_name']) ||
  5.         !isset($_POST['email']) ||
  6.         !isset($_POST['comments']) ||
  7.         !isset($_POST['comments']) ||
  8.         !isset($_POST['comments']) ||
  9.         !isset($_POST['comments']) ||
  10.         !isset($_POST['comments']) ||
  11.         !isset($_POST['comments']) ||
  12.         !isset($_POST['comments']) ||
  13.         !isset($_POST['comments']) ||
  14.         !isset($_POST['comments']) ||
  15.         !isset($_POST['comments']) ||
  16.         !isset($_POST['comments'])) {
  17.         died('We are sorry, but there appears to be a problem with the form you submitted.');      
  18.     }
  19.  
  20.     $first_name = $_POST['first_name']; // required
  21.     $last_name = $_POST['last_name']; // required
  22.     $email_from = $_POST['email']; // required
  23.     $Role = $_POST['comment']; 
  24.     $RAM = $_POST['comment'];
  25.     $RAID = $_POST['comment']; 
  26.     $HDD1 = $_POST['comment']; 
  27.     $HDD2 = $_POST['comment']; 
  28.     $OS = $_POST['comment'];
  29.     $GPU = $_POST['comment']; 
  30.     $Extras = $_POST['comment']; 
  31.     $Accessories = $_POST['comment'];
  32.     $Guarantee = $_POST['comment']; 
  33.     $customer = $_POST['comment']; 
  34.     $budget = $_POST['comment']; 
  35.  
  36.     $error_message = "";
  37.     $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
  38.   if(!preg_match($email_exp,$email_from)) {
  39.     $error_message .= 'The Email Address you entered does not appear to be valid.<br />';
  40.   }
  41.     $string_exp = "/^[A-Za-z .'-]+$/";
  42.   if(!preg_match($string_exp,$first_name)) {
  43.     $error_message .= 'The First Name you entered does not appear to be valid.<br />';
  44.   }
  45.   if(!preg_match($string_exp,$last_name)) {
  46.     $error_message .= 'The Last Name you entered does not appear to be valid.<br />';
  47.   }
  48.   if(strlen($Role) < 2) {
  49.     $error_message .= 'The Role you entered do not appear to be valid.<br />';
  50.   }
  51.   if(strlen($RAM) < 2) {
  52.     $error_message .= 'The RAM you entered do not appear to be valid.<br />';
  53.   }
  54.   if(strlen($RAID) < 2) {
  55.     $error_message .= 'The RAID you entered do not appear to be valid.<br />';   
  56.   }
  57.   if(strlen($HDD1) < 2) {
  58.     $error_message .= 'The HHD1 you entered do not appear to be valid.<br />';
  59.   }
  60.   if(strlen($HDD2) < 2) {
  61.     $error_message .= 'The HDD2 you entered do not appear to be valid.<br />';
  62.   }
  63.   if(strlen($OS) < 2) {
  64.     $error_message .= 'The OS you entered do not appear to be valid.<br />';
  65.   }
  66.   if(strlen($GPU) < 2) {
  67.     $error_message .= 'The GPU you entered do not appear to be valid.<br />';
  68.   }
  69.   if(strlen($Extras) < 2) {
  70.     $error_message .= 'The Extras you entered do not appear to be valid.<br />';
  71.   }
  72.   if(strlen($Accessories) < 2) {
  73.     $error_message .= 'The Accessories you entered do not appear to be valid.<br />';   
  74.   }
  75.   if(strlen($Guarantee) < 2) {
  76.     $error_message .= 'The Guarantee you entered do not appear to be valid.<br />';
  77.   }
  78.   if(strlen($customer) < 2) {
  79.     $error_message .= 'The customer you entered do not appear to be valid.<br />';   
  80.   }
  81.   if(strlen($budget) < 2) {
  82.     $error_message .= 'The budget you entered do not appear to be valid.<br />';   
  83.   }
  84.   if(strlen($error_message) > 0) {
  85.     died($error_message);
  86.   }
  87.     $email_message = "Form details below.\n\n";
  88.  
  89.     function clean_string($string) {
  90.       $bad = array("content-type","bcc:","to:","cc:","href");
  91.       return str_replace($bad,"",$string);
  92.     }
  93.  
  94.     $email_message .= "First Name: ".clean_string($first_name)."\n";
  95.     $email_message .= "Last Name: ".clean_string($last_name)."\n";
  96.     $email_message .= "Email: ".clean_string($email_from)."\n";
  97.     $email_message .= "Role: ".clean_string($comments)."\n";
  98.     $email_message .= "RAM: ".clean_string($comments)."\n";
  99.     $email_message .= "RAID: ".clean_string($comments)."\n";
  100.     $email_message .= "HDD1: ".clean_string($comments)."\n";
  101.     $email_message .= "HDD2: ".clean_string($comments)."\n";
  102.     $email_message .= "OS: ".clean_string($comments)."\n";
  103.     $email_message .= "GPU: ".clean_string($comments)."\n";
  104.     $email_message .= "Extras: ".clean_string($comments)."\n";
  105.     $email_message .= "Accessories: ".clean_string($comments)."\n";
  106.     $email_message .= "Guarantee: ".clean_string($comments)."\n";
  107.     $email_message .= "customer: ".clean_string($comments)."\n";
  108.     $email_message .= "budget: ".clean_string($comments)."\n";
Oct 25 '11 #6
zorgi
431 Expert 256MB
This is probably the problem line:
Expand|Select|Wrap|Line Numbers
  1. died('We are sorry, but there appears to be a problem with the form you submitted.');
  2.  
http://php.net/manual/en/function.die.php
Oct 25 '11 #7
Hi, I've removed that line of code but problem is still there. Think there is an issue with this
Expand|Select|Wrap|Line Numbers
  1. function die($error) {
  2.         // your error code can go here
  3.         echo "We are very sorry, but there were error(s) found with the form you submitted. ";
  4.         echo "These errors appear below.<br /><br />";
  5.         echo $error."<br /><br />";
  6.         echo "Please go back and fix these errors.<br /><br />";
  7.         die();
as this is the error message always being displayed.
Oct 25 '11 #8
Rabbit
12,516 Expert Mod 8TB
Is your field called comments or comment? You use both and one of them is wrong.
Oct 26 '11 #9
Thanks, that seems to have helped. The form now submits! However when it appears in my email, its only displaying the last value (the budget) that was entered.

This is the form how it appears in my inbox:
Expand|Select|Wrap|Line Numbers
  1. First Name: Test
  2. Last Name: Customer
  3. Email: email@email.com
  4. Role: 400
  5. RAM: 400
  6. RAID: 400
  7. HDD1: 400
  8. HDD2: 400
  9. OS: 400
  10. GPU: 400
  11. Extras: 400
  12. Accessories: 400
  13. Guarantee:
  14. Customer: 400
  15. Budget: 400 
Is there anything that needs to be changed in the PHP. I think this is the part of code that needs to be changed:
Expand|Select|Wrap|Line Numbers
  1.     $email_message = "Form details below.\n\n";
  2.  
  3.     function clean_string($string) {
  4.       $bad = array("content-type","bcc:","to:","cc:","href");
  5.       return str_replace($bad,"",$string);
  6.     }
  7.  
  8.     $email_message .= "First Name: ".clean_string($first_name)."\n";
  9.     $email_message .= "Last Name: ".clean_string($last_name)."\n";
  10.     $email_message .= "Email: ".clean_string($email_from)."\n";
  11.     $email_message .= "Role: ".clean_string($Role)."\n";
  12.     $email_message .= "RAM: ".clean_string($RAID)."\n";
  13.     $email_message .= "RAID: ".clean_string($RAID)."\n";
  14.     $email_message .= "HDD1: ".clean_string($HDD1)."\n";
  15.     $email_message .= "HDD2: ".clean_string($HDD2)."\n";
  16.     $email_message .= "OS: ".clean_string($OS)."\n";
  17.     $email_message .= "GPU: ".clean_string($GPU)."\n";
  18.     $email_message .= "Extras: ".clean_string($Extras)."\n";
  19.     $email_message .= "Accessories: ".clean_string($Accessories)."\n";
  20.     $email_message .= "Guarantee: ".clean_string($guarantee)."\n";
  21.     $email_message .= "Customer: ".clean_string($customer)."\n";
  22.     $email_message .= "Budget: ".clean_string($budget)."\n";
  23.  
Oct 26 '11 #10
zorgi
431 Expert 256MB
You assigned same value to all of them:

Expand|Select|Wrap|Line Numbers
  1.     $Role = $_POST['comment']; 
  2.     $RAM = $_POST['comment'];
  3.     $RAID = $_POST['comment']; 
  4.     $HDD1 = $_POST['comment']; 
  5.     $HDD2 = $_POST['comment']; 
  6.     $OS = $_POST['comment'];
  7.     $GPU = $_POST['comment']; 
  8.     $Extras = $_POST['comment']; 
  9.     $Accessories = $_POST['comment'];
  10.     $Guarantee = $_POST['comment']; 
  11.     $customer = $_POST['comment']; 
  12.     $budget = $_POST['comment']; 
  13.  
Oct 27 '11 #11
I've changed them to
Expand|Select|Wrap|Line Numbers
  1.     $first_name = $_POST['first_name']; // required
  2.     $last_name = $_POST['last_name']; // required
  3.     $email_from = $_POST['email']; // required
  4.     $Role = $_POST['comments']; 
  5.     $RAM = $_POST['comments1'];
  6.     $RAID = $_POST['comments2']; 
  7.     $HDD1 = $_POST['comments3']; 
  8.     $HDD2 = $_POST['comments4']; 
  9.     $OS = $_POST['comments5'];
  10.     $GPU = $_POST['comments6']; 
  11.     $Extras = $_POST['comments7']; 
  12.     $Accessories = $_POST['comments8'];
  13.     $Guarantee = $_POST['comments9']; 
  14.     $customer = $_POST['comments10']; 
  15.     $budget = $_POST['comments11']; 
  16.  
but I'm again recieving the error messages that I was before.

Do you need different values depending on what, for example, budget, says.

Role, RAM, RAID, HDD1, HDD2, OS, GPU and Guarantee are drop down menus. Extras and Accessories are tick boxes. customer and budget are text boxes.

Currently all of the error messages for the above words are like this:
Expand|Select|Wrap|Line Numbers
  1.   if(strlen($Role) < 2) {
  2.     $error_message .= 'The Role you entered do not appear to be valid.<br />';
  3.  
Oct 27 '11 #12
Rabbit
12,516 Expert Mod 8TB
On the HTML form
Expand|Select|Wrap|Line Numbers
  1. <input type="textbox" name="bob" />
On the PHP page
Expand|Select|Wrap|Line Numbers
  1. $_POST['bob'];
They need to match.
Oct 27 '11 #13
All matching now, but the site is giving a new Parse Error message. This time it's
'Parse error: syntax error, unexpected T_STRING in /www/zymichost.com/m/y/c/mycustombuiltpc/htdocs/CustomForm.php on line 48'
when Line 48 is
Expand|Select|Wrap|Line Numbers
  1. $Memory Size = $_POST['ram'];
Oct 28 '11 #14
Rabbit
12,516 Expert Mod 8TB
You have a space in your variable name.
Oct 28 '11 #15
All spaces removed. Now getting this Error coding on the site: We are very sorry, but there were error(s) found with the form you submitted. These errors appear below.

The RAID you entered do not appear to be valid.
The Extras you entered do not appear to be valid.
The Accessories you entered do not appear to be valid.
The Customer Specifics you entered do not appear to be valid.
The Maximum Budget you entered do not appear to be valid.


Please go back and fix these errors.


The respective coding for each of the above are:
Expand|Select|Wrap|Line Numbers
  1. !isset($_POST['raid']) ||
  2.  
  3. $RAID = $_POST['raid']; 
  4.  
  5.   if(strlen($RAID) < 2) {
  6.     $error_message .= 'The RAID you entered do not appear to be valid.<br />';   
  7.   }
  8.  
  9. $email_message .= "RAID: ".clean_string($raid)."\n";
  10.  
Expand|Select|Wrap|Line Numbers
  1. !isset($_POST['extras']) ||
  2.  
  3. $Optional_Extras = $_POST['extras']; 
  4.  
  5. if(strlen($Optional_Extras) < 2) {
  6.     $error_message .= 'The Extras you entered do not appear to be valid.<br />';
  7.   }
  8.  
  9. $email_message .= "Optional Extras: ".clean_string($extras)."\n";
  10.  
Expand|Select|Wrap|Line Numbers
  1. !isset($_POST['accessories']) ||
  2.  
  3. $Accessory_Packs = $_POST['accessories'];
  4.  
  5. if(strlen($Accessory_Packs [2]) < 2) {
  6.     $error_message .= 'The Accessories you entered do not appear to be valid.<br />';   
  7.   }
  8.  
  9. $email_message .= "Accessory Packs [2]: ".clean_string($accessories)."\n";
  10.  
Expand|Select|Wrap|Line Numbers
  1. !isset($_POST['customer']) ||
  2.  
  3. $Customer_Specifics = $_POST['customer'];
  4.  
  5. if(strlen($Customer_Specifics) < 2) {
  6.     $error_message .= 'The Customer Specifics you entered do not appear to be valid.<br />';   
  7.   }
  8.  
  9. $email_message .= "Customer Specifics: ".clean_string($customer)."\n";
  10.  
Expand|Select|Wrap|Line Numbers
  1. !isset($_POST['budget'])) ||
  2.  
  3. $Maximum_Budget = $_POST['budget']; 
  4.  
  5. if(strlen($Maximum_Budget) < 2) {
  6.     $error_message .= 'The Maximum Budget you entered do not appear to be valid.<br />';   
  7.   }
  8.  
  9. $email_message .= "Maximum Budget: ".clean_string($budget)."\n";
  10.  
The names on the HTML are the same as on the PHP so I think it's something I'm just failing to see.
Oct 28 '11 #16
Rabbit
12,516 Expert Mod 8TB
That depends on what's being passed to the PHP page and whether or not they meet the validation you set.
Oct 28 '11 #17
This is the HTML code which makes up the form.
Expand|Select|Wrap|Line Numbers
  1. <form name="customform" method="post" action="CustomForm.php">
  2.                 <table width="350" align="center" id="customform">
  3.                 </tr>
  4.                 <tr>
  5.                  <td align="left" valign="top">
  6.                   <label for="first_name">First Name </label>                 </td>
  7.                  <td align="left" valign="top">
  8.                   <input  type="text" name="first_name" maxlength="50" size="30"></td>
  9.                 </tr>
  10.  
  11.                 <tr>
  12.                  <td align="left" valign="top"">
  13.                   <label for="last_name">Last Name </label>                 </td>
  14.                  <td align="left" valign="top">
  15.                   <input  type="text" name="last_name" maxlength="50" size="30"></td>
  16.         </tr>
  17.                 <tr>
  18.                 <td align="left" valign="top">
  19.                   <label for="email">Email Address </label>                 </td>
  20.                  <td align="left" valign="top">
  21.                   <input  type="text" name="email" maxlength="80" size="30"></td>
  22.                 </tr>
  23.  
  24.                 <tr>
  25.                 <td align="left" valign="top">
  26.                   <label for="role">Role </label>                 </td>
  27.                  <td align="left" valign="top">
  28.  
  29.                   <select name="role">
  30.                     <option value="Choose"> </option>
  31.                     <option value="Home">Home</option>
  32.                     <option value="Home/ Office">Home/ Office</option>
  33.                     <option value="Home/ Gaming">Home/ Gaming      </option>
  34.                     <option value="Core Gaming">Core Gaming</option>
  35.                     <option value="Unsure">Unsure[1]</option>
  36.                   </select></td>
  37.                 </tr>
  38.  
  39.                 <tr>
  40.                 <td align="left" valign="top">
  41.                   <label for="ram">Memory Size</label>                 </td>
  42.                  <td align="left" valign="top">
  43.                   <select name="ram">
  44.                 <option value="Choose"> </option>
  45.                 <option value="2GB">2GB</option>
  46.                 <option value="4GB">4GB</option>
  47.                 <option value="8GB">8GB</option>
  48.                 <option value="16GB">16GB</option>
  49.                 <option value="customer">Other (Please Specify)</option>
  50.                 <option value="role">Role Specific</option>
  51.                 </select></td>
  52.                 </tr>
  53.  
  54.                 <tr>
  55.                 <td align="left" valign="top">
  56.                   <label for="raid">RAID</label>                 </td>
  57.                  <td align="left" valign="top">
  58.                   <select name="raid">
  59.                 <option value="Choose"> </option>
  60.                 <option value="Y">Yes*</option>
  61.                 <option value="N">No</option>
  62.                 </select>
  63.                   <span class="style8">(*Requires 2 identical Hard Drives)</span></td>
  64.                 </tr>
  65.  
  66.                 <tr>
  67.                 <td align="left" valign="top">
  68.                   <label for="hdd1">Hard Drive 1 </label>                 </td>
  69.                  <td align="left1" valign="top">
  70.                   <select name="hdd1">
  71.                 <option value="Choose"> </option>
  72.                 <option value="250GB">250GB</option>
  73.                 <option value="320GB">320GB</option>
  74.                 <option value="500GB">500GB</option>
  75.                 <option value="750GB">750GB</option>
  76.                 <option value="1TB">1TB</option>
  77.                 <option value="1.5TB">1.5TB</option>
  78.                 <option value="2TB">2TB</option>
  79.                 <option value="role">Role Specific</option>
  80.                 </select></td>
  81.                 </tr>
  82.  
  83.                 <tr>
  84.                 <td align="left" valign="top">
  85.                   <label for="hdd2">Hard Drive 2 </label>                 </td>
  86.                  <td align="left" valign="top">
  87.                   <select name="hdd2">
  88.                 <option value="Choose"> </option>
  89.                 <option value="250GB">250GB</option>
  90.                 <option value="320GB">320GB</option>
  91.                 <option value="500GB">500GB</option>
  92.                 <option value="750GB">750GB</option>
  93.                 <option value="1TB">1TB</option>
  94.                 <option value="1.5TB">1.5TB</option>
  95.                 <option value="2TB">2TB</option>
  96.                 <option value="role">Role Specific</option>
  97.                 </select></td>
  98.                 </tr>
  99.  
  100.                 <tr>
  101.                 <td align="left" valign="top">
  102.                   <label for="os">Operating System </label>                 </td>
  103.                  <td align="left" valign="top">
  104.                   <select name="os">
  105.                 <option value="Choose"> </option>
  106.                 <option value="WinXP">Windows XP</option>
  107.                 <option value="Win7">Windows 7</option>
  108.                 <option value="None">None</option>
  109.                 </select></td>
  110.                 </tr>
  111.  
  112.                 <tr>
  113.                 <td align="left" valign="top">
  114.                   <label for="gpu">Graphics Card </label>                 </td>
  115.                  <td align="left" valign="top">
  116.                   <select name="gpu">
  117.                 <option value="Choose"> </option>
  118.                 <option value="512MB">512MB</option>
  119.                 <option value="1GB">1GB</option>
  120.                 <option value="1.5GB">1.5GB</option>
  121.                 <option value="2GB">2GB</option>
  122.                 <option value="3GB">3GB</option>
  123.                 <option value="3D">nVidia 3D [Pack 5]</option>
  124.                 <option value="role">Role Specific</option>
  125.                 <option value="None">None (Chipset)</option>
  126.                 </select>
  127.                   [All nVidia] </td>
  128.                 </tr>
  129.  
  130.                 <tr>
  131.                 <td height="146" align="left" valign="top">
  132.                   <label for="extras">Optional Extras </label>                 </td>
  133.                 <td align="left" valign="top">
  134.                   <input type="checkbox" name="Extras" value="TV"/> 
  135.                   TV Card <br />
  136.                   <input type="checkbox" name="Extras" value="Sound" /> 
  137.                   Sound Card  <br />
  138.                   <input name="Extras" type="checkbox" value="Disk" /> 
  139.                   Disk Drive <br />
  140.                   <input name="Extras" type="checkbox" value="WiFi" /> 
  141.                   WiFi  Connectivity <br />
  142.                   <input type="checkbox" name="Extras" value="Bluetooth" /> 
  143.                   Bluetooth <br />
  144.                   <input type="checkbox" name="Extras" value="S.B.D." /> 
  145.                   Seperate Boot Drive <br />
  146.                   <input type="checkbox" name="Extras" value="MemCard" /> 
  147.                   Memory Card Reader </td>
  148.                 </tr>
  149.  
  150.                 <tr>
  151.                 <td align="left" valign="top">
  152.                   <label for="accessories">Accessory Packs [2]</label>                 </td>
  153.                 <td align="left" valign="top">
  154.                  <input name="accessories" type="checkbox" value="None" checked="checked"/> 
  155.                   None <br />
  156.                   <input type="checkbox" name="accessories" value="1" /> 
  157.                   Pack 1  <br />
  158.                   <input type="checkbox" name="accessories" value="2" /> 
  159.                   Pack 2 <br />
  160.                   <input type="checkbox" name="accessories" value="3" /> 
  161.                   Pack 3 <br />
  162.                   <input type="checkbox" name="accessories" value="4" /> 
  163.                   Pack 4 <br />
  164.                   <input type="checkbox" name="accessories" value="5" /> 
  165.                   Pack 5 <br />
  166.                   <input type="checkbox" name="accessories" value="6" /> 
  167.                   Pack 6 <br />
  168.                   <input type="checkbox" name="accessories" value="Other" /> 
  169.                   Other (Please Specify) <br />                  </select>                  </td>
  170.                 </tr>
  171.  
  172.                 <tr>
  173.                 <td align="left" valign="top">
  174.                   <label for="guarantee">Guarantee </label>                 </td>
  175.                  <td align="left" valign="top">
  176.                   <select name="guarantee">
  177.                 <option value=" "> </option>
  178.                 <option value="No Yr">No Extension</option>
  179.                 <option value="1 Yr">1 Year Extension</option>
  180.                 <option value="2 Yr">2 Year Extension</option>
  181.                 </select></td>
  182.                 </tr>
  183.  
  184.                 <tr>
  185.                   <td align="left" valign="center">
  186.                   <label for="customer">Customer Specifics </label>                </td>
  187.                  <td align="left" valign="top">
  188.                     <textarea name="comments" cols="25" rows="6">Enter any options you selected as 'Other'. Also add any extras that you'd like and are not listed above.</textarea></td>
  189.                 </tr>
  190.  
  191.                 <tr>
  192.                   <td align="left" valign="center">
  193.                   <label for="budget">Maximum Budget </label>                </td>
  194.                  <td align="left" valign="top">
  195.                     <input name="comments" type="text" value="£ Max." size="25" maxlength="50" /></td>
  196.                 </tr>
  197.  
  198.                 <tr>
  199.                  <td colspan="2" style="text-align:center">
  200.                   <input type="submit" value="Request Quote"></td>
  201.                 </tr>
  202.                 </table>
Oct 29 '11 #18
zorgi
431 Expert 256MB
You have this in yor HTML:

Expand|Select|Wrap|Line Numbers
  1. <select name="raid">
  2. <option value="Choose"> </option>
  3. <option value="Y">Yes*</option>
  4. <option value="N">No</option>
  5. </select>
And than in your php you have:

Expand|Select|Wrap|Line Numbers
  1. $RAID = $_POST['raid'];  
  2.   if(strlen($RAID) < 2) {
  3.     $error_message .= 'The RAID you entered do not appear to be valid.<br />';   
  4.   }
  5.  
  6. $email_message .= "RAID: ".clean_string($raid)."\n";
This can only be valid for <option value="Choose"></option>
.
http://php.net/manual/en/function.strlen.php
Oct 29 '11 #19
zorgi
431 Expert 256MB
Also be careful with capital letters. In your HTML you have:

Expand|Select|Wrap|Line Numbers
  1. <input type="checkbox" name="Extras" value="TV"/>
and in your php

Expand|Select|Wrap|Line Numbers
  1. $Optional_Extras = $_POST['extras'];
Extras != extras
Oct 29 '11 #20
zorgi
431 Expert 256MB
Inconsistencies like two I described are repeating.
Oct 29 '11 #21
Thought I had it fixed, but still have the error messages for RAID, Accessories and Guarantee.

RAID
Expand|Select|Wrap|Line Numbers
  1. !isset($_POST['raid']) ||
  2.  
  3. $RAID = $_POST['raid'];
  4.  
  5. if(strlen($RAID) < 2) {
  6.     $error_message .= 'The RAID you entered do not appear to be valid.<br />';   
  7.   }
  8.  
  9. $email_message3 .= "RAID: ".clean_string($RAID)."\n";
  10.  
  11. <tr>
  12.                 <td align="left" valign="top">
  13.                   <label for="raid">RAID </label>                 </td>
  14.                  <td align="left" valign="top">
  15.                   <select name="raid">
  16.                     <option value="raid"> </option>
  17.                     <option value="Y">Yes*</option>
  18.                     <option value="N">No</option>
  19.                   </select>
  20.                   <span class="style8">(*Requires 2 identical Hard Drives)</span></td>
  21.                 </tr>
  22.  
Accessories
Expand|Select|Wrap|Line Numbers
  1. !isset($_POST['accessories']) ||
  2.  
  3. $Accessory_Packs = $_POST['accessories'];
  4.  
  5. if(strlen($Accessory_Packs) < 2) {
  6.     $error_message .= 'The Accessories you entered do not appear to be valid.<br />';   
  7.   }
  8.  
  9. $email_message9 .= "Accessory Packs: ".clean_string($Accessory_Packs)."\n";
  10.  
  11. <tr>
  12.                 <td align="left" valign="top">
  13.                   <label for="accessories">Accessory Packs [2]</label>                 </td>
  14.                 <td align="left" valign="top">
  15.                  <input type="checkbox" name="accessories" value="0" checked="checked"/> 
  16.                   None <br />
  17.                   <input type="checkbox" name="accessories" value="1" /> 
  18.                   Pack 1  <br />
  19.                   <input type="checkbox" name="accessories" value="2" /> 
  20.                   Pack 2 <br />
  21.                   <input type="checkbox" name="accessories" value="3" /> 
  22.                   Pack 3 <br />
  23.                   <input type="checkbox" name="accessories" value="4" /> 
  24.                   Pack 4 <br />
  25.                   <input type="checkbox" name="accessories" value="5" /> 
  26.                   Pack 5 <br />
  27.                   <input type="checkbox" name="accessories" value="6" /> 
  28.                   Pack 6 <br />
  29.                   <input type="checkbox" name="accessories" value="Other" /> 
  30.                   Other (Please Specify) <br />                  </select>                  </td>
  31.                 </tr>
  32.  
Guarantee
Expand|Select|Wrap|Line Numbers
  1. !isset($_POST['guarantee']) ||
  2.  
  3. $Guarantee = $_POST['guarantee'];
  4.  
  5. if(strlen($Guarantee) < 2) {
  6.     $error_message .= 'The Guarantee you entered do not appear to be valid.<br />';
  7.   }
  8.  
  9. $email_message10 .= "Guarantee: ".clean_string($Guarantee)."\n";
  10.  
  11. <tr>
  12.                 <td align="left" valign="top">
  13.                   <label for="guarantee">Guarantee </label>                 </td>
  14.                  <td align="left" valign="top">
  15.                   <select name="guarantee">
  16.                 <option value="guarantee"> </option>
  17.                 <option value="0">No Extension</option>
  18.                 <option value="1">1 Year Extension</option>
  19.                 <option value="2">2 Year Extension</option>
  20.                 </select></td>
  21.                 </tr>
  22.  
Think I'm missing something here, but just can't seem to get it to work.
Oct 29 '11 #22
zorgi
431 Expert 256MB
I think you missed that link I gave you before:

http://php.net/manual/en/function.strlen.php

strlen("1") is 1 and 1 < 2
strlen("2") is 1 and 1 < 2
strlen("Y") is 1 and 1 < 2
Oct 29 '11 #23
How do I get around this then? I don't understand what the link shows in respect to the errors in my PHP.
Oct 30 '11 #24

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Wescotte | last post by:
The error message Parse error: syntax error, unexpected $end in FILE on line X is one I run into frequently and I know the cause is I missed an ending quote. Is there an easy way to determine...
4
kestrel
by: kestrel | last post by:
I have some html code that is supposed to be displayed by php echo. But for some reason i keep getting a syntax error, and i cant figure out what is going on. Heres what i have <?php...
36
by: rhys | last post by:
My Gurus and Angels -- Please pardon this old-school programmer, only recently enlightened to open-source, having been trapped in the convenience of proprietary lingos for way too long. My...
3
by: SilvaZodiac | last post by:
Hi everyone, I'm still rather new to PHP code, and I have a syntax error. I've tried several different solutions, but it won't fix. It seems to suggest that I need a new bracket somewhere in the...
3
paulrajj
by: paulrajj | last post by:
hi to all, i am getting syntax error on my code.. Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in D:\xampp\htdocs\Dummy\paulraj\matrim\exam.php on line 62 ...
10
by: benicio | last post by:
Parse error: syntax error, unexpected T_STRING, expecting '(' in C:\wamp\www\study_group\includes\functions.php on line 19 I got this error and this syntax is from 8 to 19th line. <?php ...
2
by: erone | last post by:
Hello, good morning. I have a syntax error here. Can you help? Thanks. It's a Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' on the "echo" line : <? $sql = "SELECT addrid,...
3
by: brkseven | last post by:
Looking for help with this Contact Form. The error is on line 1, but that' doesn't mean a lot, I think. In fact, a php syntax check passed it, but I was hoping for an easy syntax error, it looks...
5
by: vultren | last post by:
Parse error: syntax error, unexpected $end in I keep getting that, I have no clue where to fix it. Any help would be VERY APPRECIATED! <?php if(isset($_POST)) { // EDIT THE 2 LINES...
2
by: Vicki Hendra | last post by:
Hi I am new to php fullstop I and colleagues have setup wordpress blogs for our local towns, giving the local businesses free advertisment. Part of the problem started when using wordpress...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.