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
Module pool selction screen parameters combination logic
Hi floks,
Am new to the module pool development ,Recently i have created one program based on
session checking in page load
hai all
I have a web site is www.Mryas.com in this my login page is Page1.aspx its co
the problem with str_replace
$str="hahahahahahahahahahahahahaha";
$nn=1;
$str=str_replace('ha','MyGod',$str,$nn);
user validation always displaying invalid ? please help
Hello,
I have 2 accounts and there is a field in mysql called validated it can be either &quo
remove innitial and
tags
i am using tiny_mce as a text editor for my CMS.
buy now the problem is it add <p>
SCO Unix
I know this might not be the place to ask, but, can anyone tell me if SCO Unix comes with PHP built
Alternate messaging
I have 4 strings in MySQL db1
$string1 : Hello
$string2 : Hi
$string3 : Great
$strin
Extra fields in main body and php required.
I'm new to PHP so please be gentle. I have a little php script below that works well.
The &quo
noob question
i traying to do a php form with auto replay for both(me and the user who send me a mail),
a u
losing session vars when arriving from an email link
Hi,
I've got a confirmation script made that sends an email with a link for a user to confirm