Jump to content

newbie vote Q


2wasted

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
Link to comment
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
Link to comment
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!
Link to comment
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.