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.
Did you know?Explore Trending and Topic pages for more stories like this.

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

socket makes browser hang...
I have a socket server, and I am having a problem at the moment...

A browser sends a http hea

Help a newbee save my job !
Hey guys i am dying here i am new to php and would like for someone to help me with this problem

Pagination
Hi All,

I think I'm finally getting somewhere with pagination!

I can now submit a quer

Using two $_POST Function / Switch () statements, second does not work.
Hi all. I’m new to php and am having a problem getting $_POST Function / switch () to work. I

OPINIONS WANTED
This is my login page code, and I want your opinion on it please!

Code: // Login ~ CHECKS

undefined offset help
Hi All,

I kept getting undefined offset PHP notice for a simple for loop. For eg
$va = arr

having probem inserting data into db table
hi

i have a table with following columns in it
Code: candidate_id, degree, cgpa, institute

Find occurences of unicode characters in string
I need to prohibit filenames with everything but English characters and numbers but regexp and strin

iterating through an array and escape each value independently.
I have a set up where the variable being escaped is an array and it needs to be iterated and escaped

Writting a script to arrange images........ need some help
Ok so here is the link

http://hmtotc.com/dev/projects/vrassociates/jeweler_dev/admin/index.ph

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