Whats wrong with my query?


Posted on 16th Feb 2014 07:03 pm by admin

I am trying to get this query to show the appropriate ticked vehicle roof height, unless no boxs are ticked then I want it to display all vehicle roof heights. However it doesn't work correctly, for example if i tick the Standard roof Height checkbox then submit the form and echo the $RoofHeight to the page I get:

Code: N/A', 'Standard Roof', 'Medium Roof', 'High Roof
The same goes if I check the medium or high roof buttons.

If I tick the N/A button then it just returns "N/A", so why does it work for 1 tickbox but not the others?

Here is my PHP code;


Code: //display all roof height vehicles when submit button isnt pressed
if (!isset($_POST['N/ARoofHeight']) && (!$_POST['Standard Roof']) && (!$_POST['Medium Roof']) && (!$_POST['High Roof'])) {
$RoofHeight = "N/A', 'Standard Roof', 'Medium Roof', 'High Roof";
}





//N/A Roof Height Only
if (isset($_POST['Submit']) && isset($_POST['N/ARoofHeight'])) {
$RoofHeight = $RoofHeight."N/A";
}



//Standard Roof Only
if (isset($_POST['Submit']) && isset($_POST['Standard Roof'])) {
$RoofHeight = $RoofHeight."Standard Roof";
}

//Medium Roof Only
if (isset($_POST['Submit']) && isset($_POST['Medium Roof'])) {
// add comma if necessary to separate
if (!empty($RoofHeight))
{
$RoofHeight = $RoofHeight."', '";
}
$RoofHeight = $RoofHeight."Medium Roof";
}


//High Roof ONLY
if (isset($_POST['Submit']) && isset($_POST['HighRoof'])) {
// add comma if necessary to separate

if (!empty($RoofHeight))
{
$RoofHeight = $RoofHeight."', '";
}
$RoofHeight = $RoofHeight."HighRoof";
}



Can anyone see whats wrong with it?

Thanks in advance

No comments posted yet

Your Answer:

Login to answer
278 Like 7 Dislike
Previous forums Next forums
Other forums

Displaying image pathname instead of image
Hello

Im trying to upload and then display images from a mysql database - Its only basic and

How to return to a previous page after running a PHP script
I'm having a bit of a melt down here because I think this should be really easy but can't work it ou

modifying query string with no page refresh
Hi everybody,
I've tried to get info about my problem all over the internet but i didn't find out

column name cancatenation within PL/SQL
I have a PLSQL store procedure, and the following statement is part of a subquery
fname||lnam

A Few Questions
Hi, I want to ask a few questions that I can't seem to find..

1) I'm creating a "shortcu

Return X values where an ID number doesnt matter
Well as for subject heading, thats the best i could think of.

Currently im having a problem w

Calling All PHPFREAKS Blackberry Users
Are you a member of PHPFreaks and have a blackberry? Well RIM just recently released Blackberry Mes

Trouble verifying database password
Thankyou to everyone who responded to my last post (I can't find the posting, it has been buried). <

MII Netweaver Server stopped due to CPIC connection Problem
Dear Experts,
We have SAP XMII 12.0 setup running on Netweaver 2004s,7.0, Java Stack only.

list files from folder, only one for each date
I have many files in a folder and wish to only list one of each date

these are the file names

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash