ShadowIce Posted January 20, 2010 Share Posted January 20, 2010 How can I make it so that this line detects if this value is <= 0, and display $error = something if it IS <= 0 ? if ($values['qtycd_0001'] != is_numeric($values['qtycd_0001']) || (!(is_numeric($values['qtycd_0001'] > 0)))){ $errors['qtycd_0001'] = ' * '.$values['qtycd_0001'].' is an invalid amount'; } Quote Link to comment Share on other sites More sharing options...
Buddski Posted January 20, 2010 Share Posted January 20, 2010 That will never work because is_numeric returns a bool value.. // This is basically ( if the value isnt numeric or the value is less than or equal to 0 it will error if (!is_numeric($values['qtycd_0001']) || $values['qtycd_0001'] <= 0) { $errors['qtycd_0001'] = ' * '.$values['qtycd_0001'].' is an invalid amount'; } Quote Link to comment Share on other sites More sharing options...
ShadowIce Posted January 20, 2010 Author Share Posted January 20, 2010 thanks, i fgt. to mention one thing though. how can i also stop float values from being entered? if (!is_numeric($values['qtycd_0001']) || $values['qtycd_0001'] <= 0 || is_float($values['qtycd_0001'])) { $errors['qtycd_0001'] = ' * '.$values['qtycd_0001'].' is an invalid amount'; } Quote Link to comment Share on other sites More sharing options...
Buddski Posted January 20, 2010 Share Posted January 20, 2010 Your code you posted there should be fine. Quote Link to comment Share on other sites More sharing options...
ShadowIce Posted January 20, 2010 Author Share Posted January 20, 2010 um, i posted that code there BECAUSE it didnt work.. Quote Link to comment Share on other sites More sharing options...
ShadowIce Posted January 20, 2010 Author Share Posted January 20, 2010 see THAT code only works on NEGATIVE floats.. NOT negative AND positive Quote Link to comment Share on other sites More sharing options...
Buddski Posted January 20, 2010 Share Posted January 20, 2010 Can you give me an example input that DOESNT error and should? Give me a few.. Quote Link to comment Share on other sites More sharing options...
ShadowIce Posted January 20, 2010 Author Share Posted January 20, 2010 Right. when I enter in -1.1 into the amount input box, this happens: * There were 7 errors in your submitted form, please correct them and try again. * Please fill in your first name * Please fill in your last name * Please fill in your address * Please fill in your country * Please fill in your city * Please fill in your state * -1.1 is an invalid amount BUT. when i enter 1.1 into the amount input box, THIS happens: * There were 6 errors in your submitted form, please correct them and try again. * Please fill in your first name * Please fill in your last name * Please fill in your address * Please fill in your country * Please fill in your city * Please fill in your state notice how it DOESN'T show an error for an invalid amount Quote Link to comment Share on other sites More sharing options...
ShadowIce Posted January 20, 2010 Author Share Posted January 20, 2010 ALSO, for SOME reason, it accepts values like -1e+24 and 1e+24 Quote Link to comment Share on other sites More sharing options...
Buddski Posted January 20, 2010 Share Posted January 20, 2010 It accepts those values because it is scientific notation.. I would suggest doing a var_dump($values['qty_0001']); and see what that outputs.. I am guessing that because its coming from the form it is actually a string so it will never be a float.. You need to do a var_dump to verify.. If this is the case you can search the string for a '.' and if it is found throw the error. Quote Link to comment Share on other sites More sharing options...
ShadowIce Posted January 20, 2010 Author Share Posted January 20, 2010 what function would i use to detect BOTH 'e' AND '.' ? Quote Link to comment Share on other sites More sharing options...
Buddski Posted January 20, 2010 Share Posted January 20, 2010 There are probably better ways to do this but its 1am and I am knackered... if (!is_numeric($values['qtycd_0001']) || $values['qtycd_0001'] <= 0 || strstr($values['qtycd_0001'],'.') || stristr($values['qtycd_0001'],'e')) { echo ' * '.$values['qtycd_0001'].' is an invalid amount'; } It should work.. Quote Link to comment Share on other sites More sharing options...
ShadowIce Posted January 20, 2010 Author Share Posted January 20, 2010 it didnt work. infact, it let me send the form data to the next page. which SHOULD NOT happen if it finds an "e", ".", or "+" Quote Link to comment Share on other sites More sharing options...
Buddski Posted January 20, 2010 Share Posted January 20, 2010 Man I need sleep.. if (!ctype_digit($values['qtycd_0001'])) { echo ' * '.$values['qtycd_0001'].' is an invalid amount'; } Quote Link to comment Share on other sites More sharing options...
ShadowIce Posted January 20, 2010 Author Share Posted January 20, 2010 ok, that SORTA worked. ALMOST perfect problem is, it displayed the error at the top of the screen and didnt actually COUNT the error? oO * 1e+24 is an invalid amount * There were 6 errors in your submitted form, please correct them and try again. * Please fill in your first name * Please fill in your last name * Please fill in your address * Please fill in your country * Please fill in your city * Please fill in your state orderform.php: <?php session_start(); require('taxheader.php'); require('sessionvars.php'); ?> <?php function spamcheck($field) { //filter_var() sanitizes the e-mail //address using FILTER_SANITIZE_EMAIL $field=filter_var($field, FILTER_SANITIZE_EMAIL); //filter_var() validates the e-mail //address using FILTER_VALIDATE_EMAIL if(filter_var($field, FILTER_VALIDATE_EMAIL)) { return TRUE; } else { return FALSE; } } function VerifyForm(&$values, &$errors) { // Do all necessary form verification if (strlen($values['f_name0001']) < 3){ $errors['f_name0001'] = '* First name too short'; }else if (strlen($values['f_name0001']) > 50){ $errors['f_name0001'] = '* First name too long'; } if ($values['f_name0001'] == ''){ $errors['f_name0001'] = '* Please fill in your first name'; } if (strlen($values['l_name0001']) < 3){ $errors['l_name0001'] = '* Last name too short'; }else if (strlen($values['l_name0001']) > 50){ $errors['l_name0001'] = '* Last name too long'; } if (htmlentities($values['l_name0001']) == ''){ $errors['l_name0001'] = '* Please fill in your last name'; } if (htmlentities($values['ad_0001']) == ''){ $errors['ad_0001'] = '* Please fill in your address'; } if (htmlentities($values['co_0001']) == ''){ $errors['co_0001'] = ' * Please fill in your country'; } if(htmlentities($values['c_0001']) == ''){ $errors['c_0001'] = ' * Please fill in your city'; } if (htmlentities($values['stateSelect']) == ''){ $errors['stateSelect'] = '* Please fill in your state'; } if (!htmlentities(is_numeric($values['qtycd_0001'])) || htmlentities(is_float($values['qtycd_0001'])) || htmlentities($values['qtycd_0001'] <= 0)) { $errors['qtycd_0001'] = ' * '.$values['qtycd_0001'].' is an invalid amount'; } if (!ctype_digit($values['qtycd_0001'])) { echo ' * '.$values['qtycd_0001'].' is an invalid amount'; } /* if (!(spamcheck($values['email']))){ $errors['email'] = '* Email address invalid'; } if(strlen($values['email']) == 0){ $errors['email'] = '* Please fill in your email'; } if (strlen($values['text']) == 0) $errors['text'] = '* Text required';*/ if (count($errors) > 0) { return false; } return true; } function DisplayForm($values, $errors) { ?><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Image Poseidon</title> <LINK href="style.css" rel="stylesheet" type="text/css"> </head> <body> <?php if (count($errors) > 0){ $fontstart = "<font color=\"#FF0000\">"; $fontend = "</font>"; if(count($errors) > 1){echo "<p>".$fontstart."* There were ".count($errors)." errors in your submitted form, please correct them and try again.".$fontend."</p>"."\n";} if(count($errors) == 1){echo "<p>".$fontstart."* There is ".count($errors)." error in your submitted form, please correct it and try again.".$fontend."</p>"."\n";} ?> <tr> <?php if($errors['f_name0001'] != ''){ ?><td class="error"><?= $fontstart.$errors['f_name0001'].$fontend ?></td><br><?php } ?> <?php if($errors['l_name0001'] != ''){?><td class="error"><?= $fontstart.$errors['l_name0001'].$fontend ?></td><br><?php } ?> <?php if($errors['ad_0001'] != ''){?><td class="error"><?= $fontstart.$errors['ad_0001'].$fontend ?></td><br><?php } ?> <?php if($errors['co_0001'] != ''){?><td class="error"><?= $fontstart.$errors['co_0001'].$fontend ?></td><br><?php } ?> <?php if($errors['c_0001'] != ''){?><td class="error"><?= $fontstart.$errors['c_0001'].$fontend ?></td><br><?php } ?> <?php if($errors['stateSelect'] != ''){?><td class="error"><?= $fontstart.$errors['stateSelect'].$fontend ?></td><br><?php } ?> <?php if($errors['qtycd_0001'] != ''){?><td class="error"><?= $fontstart.$errors['qtycd_0001'].$fontend ?></td><br><?php } ?> </tr> <?php } ?> <script type="text/javascript" src="js/highlight-active-input.js"></script> <?php require('header.php'); ?> <form action="Orderform.php" method="post"> <center> <!--<fieldset> <legend>Image Poseidon Order Form</legend> --> <table> <tr> <td><label for="fname_0001">First Name: </label></td> <td><input class="textInput" type="text" name="f_name0001" maxlength="30" id="f_name0001" size="30" /></td> </tr> <tr> <td><label for="lname_0001">Last Name: </label></td> <td><input class="textInput" type="text" name="l_name0001" maxlength="30" id="l_name0001" size="30" /></td> </tr> <tr> <td><label for="a_d0001">Shipping Address: </label></td> <td><input class="textInput" type="text" name="ad_0001" maxlength="128" id="ad_0001" size="30" /></td> </tr> <tr> <td>Country: </td> <td><select onfocus="this.style.backgroundColor='#4D6DF3';" onblur="this.style.backgroundColor='';" class="textInput" id='countrySelect' name='co_0001' style="width: 209px;"> <option value="">Choose Country</option> <option value="Afganistan">Afghanistan</option> <option value="Albania">Albania</option> <option value="Algeria">Algeria</option> <option value="American Samoa">American Samoa</option> <option value="Andorra">Andorra</option> <option value="Angola">Angola</option> <option value="Anguilla">Anguilla</option> <option value="Antigua & Barbuda">Antigua & Barbuda</option> <option value="Argentina">Argentina</option> <option value="Armenia">Armenia</option> <option value="Aruba">Aruba</option> <option value="Australia">Australia</option> <option value="Austria">Austria</option> <option value="Azerbaijan">Azerbaijan</option> <option value="Bahamas">Bahamas</option> <option value="Bahrain">Bahrain</option> <option value="Bangladesh">Bangladesh</option> <option value="Barbados">Barbados</option> <option value="Belarus">Belarus</option> <option value="Belgium">Belgium</option> <option value="Belize">Belize</option> <option value="Benin">Benin</option> <option value="Bermuda">Bermuda</option> <option value="Bhutan">Bhutan</option> <option value="Bolivia">Bolivia</option> <option value="Bonaire">Bonaire</option> <option value="Bosnia & Herzegovina">Bosnia & Herzegovina</option> <option value="Botswana">Botswana</option> <option value="Brazil">Brazil</option> <option value="British Indian Ocean Ter">British Indian Ocean Ter</option> <option value="Brunei">Brunei</option> <option value="Bulgaria">Bulgaria</option> <option value="Burkina Faso">Burkina Faso</option> <option value="Burundi">Burundi</option> <option value="Cambodia">Cambodia</option> <option value="Cameroon">Cameroon</option> <option value="Canada">Canada</option> <option value="Canary Islands">Canary Islands</option> <option value="Cape Verde">Cape Verde</option> <option value="Cayman Islands">Cayman Islands</option> <option value="Central African Republic">Central African Republic</option> <option value="Chad">Chad</option> <option value="Channel Islands">Channel Islands</option> <option value="Chile">Chile</option> <option value="China">China</option> <option value="Christmas Island">Christmas Island</option> <option value="Cocos Island">Cocos Island</option> <option value="Colombia">Colombia</option> <option value="Comoros">Comoros</option> <option value="Congo">Congo</option> <option value="Cook Islands">Cook Islands</option> <option value="Costa Rica">Costa Rica</option> <option value="Cote DIvoire">Cote D'Ivoire</option> <option value="Croatia">Croatia</option> <option value="Cuba">Cuba</option> <option value="Curaco">Curacao</option> <option value="Cyprus">Cyprus</option> <option value="Czech Republic">Czech Republic</option> <option value="Denmark">Denmark</option> <option value="Djibouti">Djibouti</option> <option value="Dominica">Dominica</option> <option value="Dominican Republic">Dominican Republic</option> <option value="East Timor">East Timor</option> <option value="Ecuador">Ecuador</option> <option value="Egypt">Egypt</option> <option value="El Salvador">El Salvador</option> <option value="Equatorial Guinea">Equatorial Guinea</option> <option value="Eritrea">Eritrea</option> <option value="Estonia">Estonia</option> <option value="Ethiopia">Ethiopia</option> <option value="Falkland Islands">Falkland Islands</option> <option value="Faroe Islands">Faroe Islands</option> <option value="Fiji">Fiji</option> <option value="Finland">Finland</option> <option value="France">France</option> <option value="French Guiana">French Guiana</option> <option value="French Polynesia">French Polynesia</option> <option value="French Southern Ter">French Southern Ter</option> <option value="Gabon">Gabon</option> <option value="Gambia">Gambia</option> <option value="Georgia">Georgia</option> <option value="Germany">Germany</option> <option value="Ghana">Ghana</option> <option value="Gibraltar">Gibraltar</option> <option value="Great Britain">Great Britain</option> <option value="Greece">Greece</option> <option value="Greenland">Greenland</option> <option value="Grenada">Grenada</option> <option value="Guadeloupe">Guadeloupe</option> <option value="Guam">Guam</option> <option value="Guatemala">Guatemala</option> <option value="Guinea">Guinea</option> <option value="Guyana">Guyana</option> <option value="Haiti">Haiti</option> <option value="Hawaii">Hawaii</option> <option value="Honduras">Honduras</option> <option value="Hong Kong">Hong Kong</option> <option value="Hungary">Hungary</option> <option value="Iceland">Iceland</option> <option value="India">India</option> <option value="Indonesia">Indonesia</option> <option value="Iran">Iran</option> <option value="Iraq">Iraq</option> <option value="Ireland">Ireland</option> <option value="Isle of Man">Isle of Man</option> <option value="Israel">Israel</option> <option value="Italy">Italy</option> <option value="Jamaica">Jamaica</option> <option value="Japan">Japan</option> <option value="Jordan">Jordan</option> <option value="Kazakhstan">Kazakhstan</option> <option value="Kenya">Kenya</option> <option value="Kiribati">Kiribati</option> <option value="Korea North">Korea North</option> <option value="Korea Sout">Korea South</option> <option value="Kuwait">Kuwait</option> <option value="Kyrgyzstan">Kyrgyzstan</option> <option value="Laos">Laos</option> <option value="Latvia">Latvia</option> <option value="Lebanon">Lebanon</option> <option value="Lesotho">Lesotho</option> <option value="Liberia">Liberia</option> <option value="Libya">Libya</option> <option value="Liechtenstein">Liechtenstein</option> <option value="Lithuania">Lithuania</option> <option value="Luxembourg">Luxembourg</option> <option value="Macau">Macau</option> <option value="Macedonia">Macedonia</option> <option value="Madagascar">Madagascar</option> <option value="Malaysia">Malaysia</option> <option value="Malawi">Malawi</option> <option value="Maldives">Maldives</option> <option value="Mali">Mali</option> <option value="Malta">Malta</option> <option value="Marshall Islands">Marshall Islands</option> <option value="Martinique">Martinique</option> <option value="Mauritania">Mauritania</option> <option value="Mauritius">Mauritius</option> <option value="Mayotte">Mayotte</option> <option value="Mexico">Mexico</option> <option value="Midway Islands">Midway Islands</option> <option value="Moldova">Moldova</option> <option value="Monaco">Monaco</option> <option value="Mongolia">Mongolia</option> <option value="Montserrat">Montserrat</option> <option value="Morocco">Morocco</option> <option value="Mozambique">Mozambique</option> <option value="Myanmar">Myanmar</option> <option value="Nambia">Nambia</option> <option value="Nauru">Nauru</option> <option value="Nepal">Nepal</option> <option value="Netherland Antilles">Netherland Antilles</option> <option value="Netherlands">Netherlands (Holland, Europe)</option> <option value="Nevis">Nevis</option> <option value="New Caledonia">New Caledonia</option> <option value="New Zealand">New Zealand</option> <option value="Nicaragua">Nicaragua</option> <option value="Niger">Niger</option> <option value="Nigeria">Nigeria</option> <option value="Niue">Niue</option> <option value="Norfolk Island">Norfolk Island</option> <option value="Norway">Norway</option> <option value="Oman">Oman</option> <option value="Pakistan">Pakistan</option> <option value="Palau Island">Palau Island</option> <option value="Palestine">Palestine</option> <option value="Panama">Panama</option> <option value="Papua New Guinea">Papua New Guinea</option> <option value="Paraguay">Paraguay</option> <option value="Peru">Peru</option> <option value="Phillipines">Philippines</option> <option value="Pitcairn Island">Pitcairn Island</option> <option value="Poland">Poland</option> <option value="Portugal">Portugal</option> <option value="Puerto Rico">Puerto Rico</option> <option value="Qatar">Qatar</option> <option value="Republic of Montenegro">Republic of Montenegro</option> <option value="Republic of Serbia">Republic of Serbia</option> <option value="Reunion">Reunion</option> <option value="Romania">Romania</option> <option value="Russia">Russia</option> <option value="Rwanda">Rwanda</option> <option value="St Barthelemy">St Barthelemy</option> <option value="St Eustatius">St Eustatius</option> <option value="St Helena">St Helena</option> <option value="St Kitts-Nevis">St Kitts-Nevis</option> <option value="St Lucia">St Lucia</option> <option value="St Maarten">St Maarten</option> <option value="St Pierre & Miquelon">St Pierre & Miquelon</option> <option value="St Vincent & Grenadines">St Vincent & Grenadines</option> <option value="Saipan">Saipan</option> <option value="Samoa">Samoa</option> <option value="Samoa American">Samoa American</option> <option value="San Marino">San Marino</option> <option value="Sao Tome & Principe">Sao Tome & Principe</option> <option value="Saudi Arabia">Saudi Arabia</option> <option value="Senegal">Senegal</option> <option value="Seychelles">Seychelles</option> <option value="Sierra Leone">Sierra Leone</option> <option value="Singapore">Singapore</option> <option value="Slovakia">Slovakia</option> <option value="Slovenia">Slovenia</option> <option value="Solomon Islands">Solomon Islands</option> <option value="Somalia">Somalia</option> <option value="South Africa">South Africa</option> <option value="Spain">Spain</option> <option value="Sri Lanka">Sri Lanka</option> <option value="Sudan">Sudan</option> <option value="Suriname">Suriname</option> <option value="Swaziland">Swaziland</option> <option value="Sweden">Sweden</option> <option value="Switzerland">Switzerland</option> <option value="Syria">Syria</option> <option value="Tahiti">Tahiti</option> <option value="Taiwan">Taiwan</option> <option value="Tajikistan">Tajikistan</option> <option value="Tanzania">Tanzania</option> <option value="Thailand">Thailand</option> <option value="Togo">Togo</option> <option value="Tokelau">Tokelau</option> <option value="Tonga">Tonga</option> <option value="Trinidad & Tobago">Trinidad & Tobago</option> <option value="Tunisia">Tunisia</option> <option value="Turkey">Turkey</option> <option value="Turkmenistan">Turkmenistan</option> <option value="Turks & Caicos Is">Turks & Caicos Is</option> <option value="Tuvalu">Tuvalu</option> <option value="Uganda">Uganda</option> <option value="Ukraine">Ukraine</option> <option value="United Arab Erimates">United Arab Emirates</option> <option value="United Kingdom">United Kingdom</option> <option value="United States of America">United States of America</option> <option value="Uraguay">Uruguay</option> <option value="Uzbekistan">Uzbekistan</option> <option value="Vanuatu">Vanuatu</option> <option value="Vatican City State">Vatican City State</option> <option value="Venezuela">Venezuela</option> <option value="Vietnam">Vietnam</option> <option value="Virgin Islands (Brit)">Virgin Islands (Brit)</option> <option value="Virgin Islands (USA)">Virgin Islands (USA)</option> <option value="Wake Island">Wake Island</option> <option value="Wallis & Futana Is">Wallis & Futana Is</option> <option value="Yemen">Yemen</option> <option value="Zaire">Zaire</option> <option value="Zambia">Zambia</option> <option value="Zimbabwe">Zimbabwe</option> </select> </tr> <tr> <td><label for="c0001">City: </label></td> <td><input class="textInput" type="text" name="c_0001" maxlength="30" id="c_0001" size="30" /></td> </tr> <br><br> <tr> <td>State: </td> <td> <select onfocus="this.style.backgroundColor='#4D6DF3';" onblur="this.style.backgroundColor='';" class="textInput" name="stateSelect" id="stateSelect" style="width: 209px;"> <option selected value="">Choose State</option> <option value="">-- UNITED STATES --</option> <option value="Alabama">Alabama</option> <option value="Alaska">Alaska</option> <option value="Arizona">Arizona</option> <option value="Arkansas">Arkansas</option> <option value="California">California</option> <option value="Colorado">Colorado</option> <option value="Connecticut">Connecticut</option> <option value="Delaware">Delaware</option> <option value="Florida">Florida</option> <option value="Georgia">Georgia</option> <option value="Hawaii">Hawaii</option> <option value="Idaho">Idaho</option> <option value="Illinois">Illinois</option> <option value="Indiana">Indiana</option> <option value="Iowa">Iowa</option> <option value="Kansas">Kansas</option> <option value="Kentucky">Kentucky</option> <option value="Louisiana">Louisiana</option> <option value="Maine">Maine</option> <option value="Maryland">Maryland</option> <option value="Massachusetts">Massachusetts</option> <option value="Michigan">Michigan</option> <option value="Minnesota">Minnesota</option> <option value="Mississippi">Mississippi</option> <option value="Missouri">Missouri</option> <option value="Montana">Montana</option> <option value="Nebraska">Nebraska</option> <option value="Nevada">Nevada</option> <option value="New Hampshire">New Hampshire</option> <option value="New Jersey">New Jersey</option> <option value="New Mexico">New Mexico</option> <option value="New York">New York</option> <option value="North Carolina">North Carolina</option> <option value="North Dakota">North Dakota</option> <option value="Ohio">Ohio</option> <option value="Oklahoma">Oklahoma</option> <option value="Oregon">Oregon</option> <option value="Pennsylvania">Pennsylvania</option> <option value="Rhode Island">Rhode Island</option> <option value="South Carolina">South Carolina</option> <option value="South Dakota">South Dakota</option> <option value="Tennessee">Tennessee</option> <option value="Texas">Texas</option> <option value="Utah">Utah</option> <option value="Vermont">Vermont</option> <option value="Virginia">Virginia</option> <option value="Washington">Washington</option> <option value="West Virginia">West Virginia</option> <option value="Wisconsin">Wisconsin</option> <option value="Wyoming">Wyoming</option> <option value="">-- CANADA --</option> <option value="Alberta">Alberta</option> <option value="British Columbia">British Columbia</option> <option value="Manitoba">Manitoba</option> <option value="New Brunswick">New Brunswick</option> <option value="Newfoundland and Labrador">Newfoundland and Labrador</option> <option value="Northwest Territories">Northwest Territories</option> <option value="Nova Scotia">Nova Scotia</option> <option value="Nunavut">Nunavut</option> <option value="Ontario">Ontario</option> <option value="Prince Edward Island">Prince Edward Island</option> <option value="Quebec">Quebec</option> <option value="Saskatchewan">Saskatchewan</option> <option value="Yukon Territory">Yukon Territory</option> <option value="">-- AUSTRALIA --</option> <option value="Australian Capital Territory">Australian Capital Territory</option> <option value="New South Wales">New South Wales</option> <option value="Northern Territory">Northern Territory</option> <option value="Queensland">Queensland</option> <option value="South Australia">South Australia</option> <option value="Tasmania">Tasmania</option> <option value="Victoria">Victoria</option> <option value="Western Australia">Western Australia</option> </select> </td> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> <td width=150>Item: <br> </td> <td width=15>Quantity: <br> </td> </tr> <tr> <td>CD</td> <td><input class="textInput" type="text" name="qtycd_0001" id="qtycd_0001" value = "1" size="30" maxlength="7"></td> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> </tr> <tr> <td>Please enter a discount code if you have one: </td> <td><input class="textInput" type="text" name="sd_0001" value="000-000-00000" size="30" maxlength="64"></td> </tr> <tr style="text-align: center;"> <td style="text-align: center;"> <input style="text-align: Center;" type = "submit" value="Go To Next Page"> </td> </tr> </table> <!--</legend> </fieldset>--> </center> </form> <script type="text/javascript"> // Initialize the input highlight script initInputHighlightScript(); </script> </body> </html><?php } function ProcessForm($values) { //mail('$adminemail', 'Form test', $values['text'], "From: \"{$values['f_name0001']}\" <{$values['email']}>"); //echo "<script>document.location = \"page2.php\";</script>\n"; echo '<META HTTP-EQUIV="Refresh" Content="0; URL=page2.php">'; } if ($_SERVER['REQUEST_METHOD'] == 'POST') { $formValues = $_POST; $formErrors = array(); // if (!VerifyForm($formValues, $formErrors)) if (!(VerifyForm($formValues, $formErrors)) || !(array_key_exists('f_name0001', $formValues))){ DisplayForm($formValues, $formErrors); }else{ ProcessForm($formValues); } }else{ DisplayForm(null, null); } ?> Quote Link to comment Share on other sites More sharing options...
Buddski Posted January 20, 2010 Share Posted January 20, 2010 I replaced it with an echo sorry.. just put your $error var in there Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.