mysql - Storing dropdown box selection in php -


this question has answer here:

have looked @ few examples - using $_post select option value html , how preselect html dropdown list php? , still bit stuck. want take user selection dropdown , store in php on page further use. using netbeans php.

userinterface.php

<form name="formname" method="post" action="index.php">     <div id='userlist'>  <?php     //get constants database     require("database.php");      // opens connection mysql server     $connection = mysqli_connect ($server, $username, $password);     if (!$connection){           die('not connected : ' . mysqli_error());     }      // set active mysql database     $db_selected = mysqli_select_db($connection, $database);     if (!$db_selected) {         die ('can\'t use db : ' . mysqli_error($connection));     }      $query = "select * route id = 1";     $result = mysqli_query($connection, $query);      echo '<select name="list" style="width:400px;">';      while($r = mysqli_fetch_assoc($result)){         echo "<option =".$r['user'].">".$r['user']."</option>";      }      echo '</select>'; ?>      <input type="submit" id="button" value="get started!" /> 

map.php - trying store value , attempt use in query

$user = filter_input(input_post, "list"); $query = "select * route user = $user"; 

the error getting 'not formed' when try echo $user. don't think value $user coming through @ all.

your option tag not valid. need provide value attribute before "=".


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -