Jump to content

Archived

This topic is now archived and is closed to further replies.

2wasted

newbie vote Q

Recommended Posts

lo all,
i have made a simple guestbook but i was wondering if i could put a simple yes/no vote on it?
can i just insert a new row on my guestbook table[mysql] then put the yes/no into the DB from radio buttons in the form?
Thx for any help:-)
Charlie

Share this post


Link to post
Share on other sites
do you want it to be there all the time? or do you want the signer of the questbook to choose if he wants it and what the questions are?(like a forum) I dont really get what you want please explain more!

Share this post


Link to post
Share on other sites
my guestbook is Name Email Comment,i would like to put into the form a yes/no radio buttons or drop down that i can keep in the DB.maybe to put in a graphic display l8ter when i learn how:-)i just want 2 know if it was hard..
thx for the reply
Charlie

Share this post


Link to post
Share on other sites
[!--quoteo(post=382134:date=Jun 9 2006, 09:38 PM:name=2wasted)--][div class=\'quotetop\']QUOTE(2wasted @ Jun 9 2006, 09:38 PM) [snapback]382134[/snapback][/div][div class=\'quotemain\'][!--quotec--]
my guestbook is Name Email Comment,i would like to put into the form a yes/no radio buttons or drop down that i can keep in the DB.maybe to put in a graphic display l8ter when i learn how:-)i just want 2 know if it was hard..
thx for the reply
Charlie
[/quote]

if your using radios just name them the same. the no one make its value 0 and the yes one 1 then go like this

if($_POST['[i]name[/i]'] == 0){
$var="No";
}else{
$var="yes";
}


then just post $var to the database... or post the number to the database then retrieve and do the code above later!

Share this post


Link to post
Share on other sites
[!--quoteo(post=382140:date=Jun 9 2006, 11:29 PM:name=legohead6)--][div class=\'quotetop\']QUOTE(legohead6 @ Jun 9 2006, 11:29 PM) [snapback]382140[/snapback][/div][div class=\'quotemain\'][!--quotec--]
if your using radios just name them the same. the no one make its value 0 and the yes one 1 then go like this

if($_POST['[i]name[/i]'] == 0){
$var="No";
}else{
$var="yes";
}
then just post $var to the database... or post the number to the database then retrieve and do the code above later!
[/quote]

cheers:-)
i'll give that a go,can i insert the new row in mysql or do i just do the db table again and put in the new row?
thx
Charlie

Share this post


Link to post
Share on other sites
just choose do add a new row, considering you are using an INT field it will automatically set all fields to a negative result of 0 if u do not set the default to 1 (given there are already entries in the book)

Share this post


Link to post
Share on other sites
[!--quoteo(post=382292:date=Jun 10 2006, 01:58 PM:name=joquius)--][div class=\'quotetop\']QUOTE(joquius @ Jun 10 2006, 01:58 PM) [snapback]382292[/snapback][/div][div class=\'quotemain\'][!--quotec--]
just choose do add a new row, considering you are using an INT field it will automatically set all fields to a negative result of 0 if u do not set the default to 1 (given there are already entries in the book)
[/quote]
thx all,
Charlie

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.