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
7
Other forums
retrieving more than one max key from an array?
so i have an array of 20 numerical values (0-100) that i need to order from highest to lowest and th
New to mysqli library - Multiple query problem
Greetings,
I am writing a batch program that executes 3 queries on a single page. Using mysql
generate seo frienly url from a text like wordpress
Convert: "åäö" to "aao", "space" to "-", "!?&q
Uploading/Downloading files stored in MySQL database
Hey all,
This problem just came up in my website and I'm having a hard time figuring out what
Keep newlines from textarea?..
I'm creating a simple encoding program, and what I want it to do is retain the newlines, as echoing
I got my hosting suspended XD
So I saw this challenge a day or so ago
http://www.programming-challenges.com/pg.php?page=dow
How to assign JS screen.width to ASP.Net variable
I've got this ASP.net routine that gets the cookie value of the screen width, but now I need to chan
upload image name with extension using php
hi frds..
<input id="file1" type="file" name="file[]" &a
Inserting a variable in a link
I have this code that I want to insert for my own variable but I have no idea how. This is what I wa
Using loop to count number of entries
I'm writing a program that must ask user to type in numbers. After each entry, the program has to re