1
I have a <select>
with several options, when selecting an option, I want the form to be submitted to the same page and I will fetch the value by php on the same page. For that, I have the following:
<?php
if(isset($_POST['select_carros']))
{
echo $_POST['select_carros'];
}
?>
<form action="" method="post" name="menuForm">
<select name="select_carros">
<option value="1">Carro 1</option>
<option value="2">Carro 2</option>
<option value="3">Carro 3</option>
</select>
</form>
Basically, what I want is that when choosing the option is printed the value of this option. For example, I choose the option "Car 2" and will be printed "2"
yes, but it is already being submitted to the same page.
– pc_oc
Then use onChange="this.form.Submit();" in the <form>.
– Lucas Henrique