Click to See Complete Forum and Search --> : Confirming


Hibbert
02-28-2004, 02:58 PM
I need to ask a user a question on a webpage to see whether they want something added to a database, by giving them a yes or no question. If they type yes they item will be added if they press no it won't. How can i do this?

Thanks In Advance

Sam
02-28-2004, 03:06 PM
html

<form action="confirm.php" method="POST">
<input type="text" name="conformation" />
</form>

confirm.php

<?php
$string=$_POST['conformation'];
if($string=="yes")
{
//add to db
}
else{
//do nothing
}
?>

Conor
02-28-2004, 03:11 PM
<?
$variable=$_POST['formanswer'];
if($variable=="yes")
{
//do your code for database addition
}
else
{
"exit";
}
?>