contra10 Posted January 26, 2009 Share Posted January 26, 2009 There are basically two options yes or no...if yes is clicked then the result is sentence 1 if no then result is sentence 2 and the form should not display after either one is clicked ALLOW THIS To BE PUBLIC? <?php mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("registration") or die(mysql_error()); if(is_numeric($_GET['eid'])){ $id = $_GET['eid']; } $idp = mysql_real_escape_string($_POST['idev']); if (isset($_POST['true'])){ mysql_query("UPDATE `events` SET `val` = 'true' WHERE `eid` = '$idp'"); if (isset($_POST['false'])){ mysql_query("UPDATE `events` SET `val` = 'false' WHERE `eid` = '$idp'"); ?> Sentence 2 <?php }else{ ?> Sentence 1 <?php }else{ ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST" > <input type="submit" name ="true" value="Yes"> <?php echo "<input type='hidden' name='idev' value='$id'>"?> <input type="submit" name ="false" value="No"> </form> <?php } ?> how can i get rid of title too Quote Link to comment Share on other sites More sharing options...
rhodesa Posted January 26, 2009 Share Posted January 26, 2009 this is how i would do it: <?php if(is_numeric($_GET['eid'])){ $id = $_GET['eid']; }else{ die("Invalid ID"); } if($_SERVER['REQUEST_METHOD'] == 'POST'){ mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("registration") or die(mysql_error()); if(isset($_POST['true'])){ mysql_query("UPDATE `events` SET `val` = 'true' WHERE `eid` = '$id'"); print "Sentence 1"; }elseif(isset($_POST['false'])){ mysql_query("UPDATE `events` SET `val` = 'false' WHERE `eid` = '$id'"); print "Sentence 2"; } exit; } ?> ALLOW THIS TO BE PUBLIC? <form action="?eid=<?php echo $id; ?>" method="POST"> <input type="submit" name ="true" value="Yes"> <input type="submit" name ="false" value="No"> </form> Quote Link to comment Share on other sites More sharing options...
contra10 Posted January 26, 2009 Author Share Posted January 26, 2009 Thank you...Ill take note Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.