Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
11-01-2007, 11:03 PM #1
- Join Date
- Sep 2007
- Thanked 0 Times in 0 Posts
Question about Insert Query = VERY URGENT
There is an existing form where a user is asked if they would like to receive emails alerts and presently it is a radio button and it has 2 options Yes & No. By default Yes is selected. So in this case the data is captured.
Now we would like to change this where the same radio buttons would appear however none of them would be checked by default, so its upto the user to select Yes or No. In this case if the radio buttons are left blank then an error occurs from the php file. I have a code to check if the radio button was unchecked so that there would be no errors. the code is =
$receiveemails = empty($_POST['receiveemails']);
if($receiveemails) $receiveemails = "Blank checkbox"; else $receiveemails = $_POST["receiveemails"];
As of now the way the code is written is as follows which was written by another person which is =
insert into table(a,b,c) values($a,$b,%s, %s)
MY QUESTION IS
1. what is %s in the insert statement actually doing
2. what is GetSQLValueString($_POST['specialOffers'], "text") code actually doing
a) what this code is doing as if i implement my code this might have a drastic impact on how data is inserted into the table in mysql. As the "specialOffers" appears in lot many places in the php file.
b) what i can do with the existing code so that Even if a user does not select the radio button data should still be inserted into the table.
Even with a checkbox if it is left blank the same error happens just like radio button.
Any help will be greatly appreciated.
11-01-2007, 11:42 PM #2
- Join Date
- Oct 2007
- Thanked 8 Times in 8 Posts
There are more values than there are columns.
None of the variables are wrapped in quotes. Are they all ints?
getsqlvaluestring is a function that is declared somewhere else. From googling it looks like it is a ready made that was created to prevent SQL injection.
As for your radio buttons, why not echo the value of $_POST['receiveemails'] and see what that gets you. I haven't worked with radio buttons in a while so I'm a little rusty there.