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
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
Retrieving innerHTML with cURL?
Hey all (sorry I know I'm a leecher, but I soon won't be. This is my first PHP project, but not my l
Do not allow posting of whitespace
Currently the script below works if the user does not type a name/message, but if i create a whitesp
Help with search.php
Hello All
I need the search engine on a site I am building at the moment to display the searc
Convert .fdf to .pdf
I currently have a web form that uploads the form data to an .fdf file and emails it.
However
Help Optimizing code
Good Morning,
I wrote a small import function for a website of mine and I know there has to b
grouping within a foreach?
hello all,
I currently have a list of products spit out from my db via a foreach loop. Right
help, header() is not working!
Hello, I have this code:
<?php
/**
* @author samoi
* @copyright 200
Floating Point Precision Loss
I'm writing a program to draw a three-dimensional cube (with a corner cut off) without using any 3D
listing help
Hi,
at first, great new design!!! I like it,
i got a problem,
I want to list so