I looked everywhere, but I didn't find answer. My code is something like this:
<form method="post" action="">
<input type="radio" name="ans" value="test">1
<input type="radio" name="ans" value="test2">2<br />
<select name="number">
<option value="one" selected="selected">1</option>
<option value="two">2</option>
</select>
<input type="submit" name="Write" value="Next" />
</form>
$ans = "BD";
if(isset($_POST['ans']))
{
$ans = $_POST['ans'];
echo "<hr /><form method='post' action=''>";
switch($_POST['number'])
{
case "one" :
echo "<textarea name='txt' rows='10' cols='150'>This is first test textarea</textarea>";
break;
case "two" :
echo "<textarea name='txt' rows='10' cols='150'>This is second test textarea</textarea>";
break;
}
echo "<br /><input type='submit' value='Send' /></form>";
}
if(isset($_POST['txt']))
{
mysql_query("INSERT INTO `MyPrivate`.`TestPage` (`ans`, `number`, `text`) VALUES ('$ans', '$number', '" . $_POST['txt'] . "');");
}
I wanna to create register (or somethink like this), but in this code I have one problem. I wanna save this things to database, but 'ans' is everytime "BD". I just want to make: $ans = $_POST['ans']; but it didn't work. Can you tell me what I am doing wrong? And if you can write me answer to this problem. Sorry, but I am not english translator :)