Home » Php » How to pass correct html select value to $_POST php

How to pass correct html select value to $_POST php

Posted by: admin July 12, 2020 Leave a comment

Questions:

I have tried html like this:

<form method="post">
   <select id="select" size="2 ">
        <option value="3">test</option>
        <option value="4">test2</option>                     
   </select>
   <button type="submit" value="execute">
</form>

How do I get a 3 or 4 value in the post array

$_POST['select']

?

How to&Answers:

Add the name tag…

<select id="select" name="select" size="2 ">