Jump to content

newbie vote Q


2wasted

Recommended Posts

[!--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!
Link to comment
https://forums.phpfreaks.com/topic/11624-newbie-vote-q/#findComment-43921
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
Link to comment
https://forums.phpfreaks.com/topic/11624-newbie-vote-q/#findComment-44066
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
Link to comment
https://forums.phpfreaks.com/topic/11624-newbie-vote-q/#findComment-44112
Share on other sites

Archived

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

×
×
  • Create New...

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.