I have a form which queries the user about which type of list he wants to see. As the submit button is pressed, I want to be able to have the value listtype displayed in the address so I can access it by using GET methods, for instance to change the page of the list that is being shown. In this form, I tried the following code:
<?php
echo '<form method=post action="index.php?operacao=checkList&number=1&pagesize=10&listtype=', $_GET['listtype'] ,'" name="listForm">
<ol>
<li><label for="listtype">Type:</label>
<select name="listtype">
<option value="default">Select</option>
<option value="doctor">Doctor</option>
<option value="nurse">Nurse</option>
<option value="patient">Patient</option>
</select></li>
<div id="form-button">
<li><input type="submit" value="Submit" onclick="javapopup();"></li>
</div>
</ol>
</form>';
?>
Although, as I open the form, I get an error that says the variable listtype is not defined. How can I solve this problem?
<form method=postand you're asking for a GET. Try using<form method="get"$var=$_GET['var'];we need to see your PHP handler.