Title: php + html
Last modified: October 11, 2018

---

# php + html

 *  Resolved [erwant](https://wordpress.org/support/users/erwant/)
 * (@erwant)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/php-html/)
 * Hello , my code is a selector in html and I would like his value to go into a
   php variable. is it possible ? thank you
 * $nbre_personnes=0;
    if($_POST[‘submit’] && $_POST[‘submit’] != 0) { $nbre_personnes
   =$_POST[‘nbre_personnes’]; } echo $nbre_personnes; ?>
 * <div>
    <select name=”nombre_personnes”> <option value=”0″>Sélectionnez le nombre
   de personnes</option> <option value=”1″>1</option> <option value=”2″>2</option
   > <option value=”3″>3</option> <option value=”4″>4</option> <option value=”5″
   >5</option> <option value=”6″>6</option> <option value=”7″>7</option> <option
   value=”8″>8</option> <option value=”9″>9</option> </select> </div>

Viewing 1 replies (of 1 total)

 *  Plugin Author [webcraftic](https://wordpress.org/support/users/webcraftic/)
 * (@webcraftic)
 * [7 years, 6 months ago](https://wordpress.org/support/topic/php-html/#post-10772890)
 * Hi,
    I corrected your code to make it work. Please check.
 *     ```
       	$nbre_personnes = 0;
       	if( isset($_POST["submit"]) ) {
       	    $nbre_personnes = $_POST["nombre_personnes"];
                   echo $nbre_personnes;
       	}
   
       ?>
   
       <div>
       	<form method="post">
       		<select name="nombre_personnes">
       			<option value="0">Sélectionnez le nombre de personnes</option>
       			<option value="1">1</option>
       			<option value="2">2</option>
       			<option value="3">3</option>
       			<option value="4">4</option>
       			<option value="5">5</option>
       			<option value="6">6</option>
       			<option value="7">7</option>
       			<option value="8">8</option>
       			<option value="9">9</option>
       		</select>
       		<input type="submit" name="submit" value="Click me">
       	</form>
       </div>
       ```
   
 * Do not forget to leave your review about the plugin, it will allow us to make
   it better and more stable!
 * Best regards, Alex

Viewing 1 replies (of 1 total)

The topic ‘php + html’ is closed to new replies.

 * ![](https://ps.w.org/insert-php/assets/icon-256x256.gif?rev=3475630)
 * [Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts](https://wordpress.org/plugins/insert-php/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-php/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-php/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-php/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-php/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-php/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [webcraftic](https://wordpress.org/support/users/webcraftic/)
 * Last activity: [7 years, 6 months ago](https://wordpress.org/support/topic/php-html/#post-10772890)
 * Status: resolved