Jump to content


Photo

newbie vote Q


  • Please log in to reply
6 replies to this topic

#1 2wasted

2wasted
  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 09 June 2006 - 11:35 PM

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

#2 legohead6

legohead6
  • Members
  • PipPipPip
  • Advanced Member
  • 434 posts

Posted 10 June 2006 - 02:04 AM

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!


"Syntax error" .. WHERE THE **** IS IT?!

#3 2wasted

2wasted
  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 10 June 2006 - 02:38 AM

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

#4 legohead6

legohead6
  • Members
  • PipPipPip
  • Advanced Member
  • 434 posts

Posted 10 June 2006 - 04:29 AM

[!--quoteo(post=382134:date=Jun 9 2006, 09:38 PM:name=2wasted)--][div class=\'quotetop\']QUOTE(2wasted @ Jun 9 2006, 09:38 PM) View Post[/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['name'] == 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!
"Syntax error" .. WHERE THE **** IS IT?!

#5 2wasted

2wasted
  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 10 June 2006 - 06:50 PM

[!--quoteo(post=382140:date=Jun 9 2006, 11:29 PM:name=legohead6)--][div class=\'quotetop\']QUOTE(legohead6 @ Jun 9 2006, 11:29 PM) View Post[/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['name'] == 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

#6 joquius

joquius
  • Members
  • PipPipPip
  • Advanced Member
  • 319 posts

Posted 10 June 2006 - 06:58 PM

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)
z..z..z..z..z..z..z..z..

#7 2wasted

2wasted
  • Members
  • PipPipPip
  • Advanced Member
  • 41 posts

Posted 10 June 2006 - 08:57 PM

[!--quoteo(post=382292:date=Jun 10 2006, 01:58 PM:name=joquius)--][div class=\'quotetop\']QUOTE(joquius @ Jun 10 2006, 01:58 PM) View Post[/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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users