By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,968 Members | 1,852 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,968 IT Pros & Developers. It's quick & easy.

Syntax error: unexpected '!'

P: 41
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
Share this Question
Share on Google+
23 Replies


zorgi
Expert 100+
P: 431
Can you give more code ... that looks just like a part of some if statement ... or is it?
Oct 25 '11 #2

P: 41
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
Expert 100+
P: 431
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

P: 41
Ok, thanks for the help, I'll try it asap
Oct 25 '11 #5

P: 41
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
Expert 100+
P: 431
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

P: 41
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
Expert Mod 10K+
P: 12,347
Is your field called comments or comment? You use both and one of them is wrong.
Oct 26 '11 #9

P: 41
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
Expert 100+
P: 431
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

P: 41
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
Expert Mod 10K+
P: 12,347
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

P: 41
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
Expert Mod 10K+
P: 12,347
You have a space in your variable name.
Oct 28 '11 #15

P: 41
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
Expert Mod 10K+
P: 12,347
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

P: 41
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
Expert 100+
P: 431
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
Expert 100+
P: 431
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
Expert 100+
P: 431
Inconsistencies like two I described are repeating.
Oct 29 '11 #21

P: 41
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
Expert 100+
P: 431
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

P: 41
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

Post your reply

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