gigabyt3r Posted September 11, 2009 Share Posted September 11, 2009 Title says it all, can't seem to figure out why it won't work? //Colour Search Box if(strlen($_POST['Colour']) != 0) { echo "Colour has a value"; } else { echo "Colour box is empty!"; } Quote Link to comment Share on other sites More sharing options...
gigabyt3r Posted September 11, 2009 Author Share Posted September 11, 2009 Realized is should be != ""; However still says Colour Box empty when its not! Quote Link to comment Share on other sites More sharing options...
syed Posted September 11, 2009 Share Posted September 11, 2009 have you tried printing the length first to make sure that the value is 0 when colour has a value. Quote Link to comment Share on other sites More sharing options...
syed Posted September 11, 2009 Share Posted September 11, 2009 //Colour Search Box if($_POST['Colour'] != "") { echo "Colour has a value"; } else { echo "Colour box is empty!"; } Quote Link to comment Share on other sites More sharing options...
gigabyt3r Posted September 11, 2009 Author Share Posted September 11, 2009 //Colour Search Box if($_POST['Colour'] != "") { echo "Colour has a value"; } else { echo "Colour box is empty!"; } Still doesn't work Quote Link to comment Share on other sites More sharing options...
syed Posted September 11, 2009 Share Posted September 11, 2009 Okay post your form html code. Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted September 11, 2009 Share Posted September 11, 2009 The form text box is definitely called Colour, not colour or color? It is case-sensitive Quote Link to comment Share on other sites More sharing options...
gigabyt3r Posted September 11, 2009 Author Share Posted September 11, 2009 The form text box is definitely called Colour, not colour or color? It is case-sensitive Yep its Colour throughout the php form Quote Link to comment Share on other sites More sharing options...
gigabyt3r Posted September 11, 2009 Author Share Posted September 11, 2009 Okay post your form html code. <form name="form1" method="post" action=""> <label></label> <p><strong><u>Make</u></strong></p> <p> <input type="checkbox" name="input" value="" /> Ford</p> <p> <input type="checkbox" name="input2" value="" /> Mercedes</p> <p> <input type="checkbox" name="input3" value="" /> Vauxhaull</p> <p> <input type="checkbox" name="input4" value="" /> Citroen</p> <p> <input type="checkbox" name="input5" value="" /> Peueot</p> <p> <input type="checkbox" name="input6" value="" /> Iveco</p> <p> <input type="checkbox" name="input7" value="" /> Fiat</p> <p> <input type="checkbox" name="input8" value="" /> Nissan</p> <p> <input type="checkbox" name="input9" value="" /> Renault</p> <p> <input type="checkbox" name="input10" value="" /> Volkswagen</p> <p> <input type="checkbox" name="input11" value="" /> Other Makes (DAF, Isuzu, MAN, Moffet, Scania, Toyota, LDV, Land Rover, Daihatsu, Mitsubishi)</p> <p> </p> <p><strong><u>Wheelbase</u></strong></p> <p> <input type="checkbox" name="AWB" value="AWB" /> All Wheelbases</p> <p> <input type="checkbox" name="SWB" value="SWB" /> Only Show Short Wheelbase Vehicles </p> <p> <input type="checkbox" name="MWB" value="MWB" /> Only Show Medium Wheelbase Vehicles </p> <p> <input type="checkbox" name="LWB" value="LWB" /> Only Show Long Wheelbase Vehicles</p> <p> </p> <p><strong><u>Roof Height</u></strong></p> <p> <input type="checkbox" name="AllRoof" value="AllRoof" /> All Roof Heights </p> <p> <input type="checkbox" name="N/A" value="N/A" /> N/A Roof Height Vehicles </p> <p> <input type="checkbox" name="StandardRoof" value="Standard Roof" /> Standard Roof </p> <p> <input type="checkbox" name="MediumRoof" value="Medium Roof" /> Medium Roof</p> <p> <input type="checkbox" name="HighRoof" value="High Roof" /> High Roof </p> <p> </p> <p><u>Colour</u></p> <p> <label> <input type="text" name="colour" id="colour" /> </label> </p> <p> </p> <p><u>Price</u></p> <p>From <label> <input type="text" name="textfield2" id="textfield2" /> </label> - <label> <input type="text" name="textfield3" id="textfield3" /> </label> </p> <p> </p> <p>Custom Search: <input type="text" name="textfield4" id="textfield4" /> </p> <p> </p> <p> <input type="submit" name="Submit" id="button" value="Submit" /> </p> <p><br /> Order results by: <select name="orderBy" id="orderBy"> <option value="`Reg Year`">Reg Year</option> <option value="`Mileage`">Mileage</option> <option value="`Wheelbase`">Wheelbase</option> <option value="`Model`">Model</option> </select></p> </form> Quote Link to comment Share on other sites More sharing options...
syed Posted September 11, 2009 Share Posted September 11, 2009 You spelled color as lower case on your form but in your php code, your spelling it as uppercase. Quote Link to comment Share on other sites More sharing options...
gigabyt3r Posted September 11, 2009 Author Share Posted September 11, 2009 You spelled color as lower case on your form but in your php code, your spelling it as uppercase. Doh. Thanks Quote Link to comment Share on other sites More sharing options...
syed Posted September 11, 2009 Share Posted September 11, 2009 Ahh well its a Friday Quote Link to comment Share on other sites More sharing options...
gigabyt3r Posted September 11, 2009 Author Share Posted September 11, 2009 Ahh well its a Friday Lol Another little problem I have is I only want specific colour vehicles to come up if a value is entered in the colour box, but if it is left blank I'd like it to return all colour vehicles. Any idea what would be the best way to do it? Quote Link to comment Share on other sites More sharing options...
gigabyt3r Posted September 30, 2009 Author Share Posted September 30, 2009 Ahh well its a Friday Lol Another little problem I have is I only want specific colour vehicles to come up if a value is entered in the colour box, but if it is left blank I'd like it to return all colour vehicles. Any idea what would be the best way to do it? Bump anyone 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.