How to display mysql data from php in html form.(NOT TABLE) -


i have been looking solution while pertain html tables. have simple form , have manually added values database using phpmyadmin. have drop down menu @ top , whenever admin selects particular name drop down menu , presses 'display fields' button, want respective fields filled in values after admin can make changes onto particular field , update. how can values filled? have tried multiple codes keep getting errors such undefined index, undefined variable etc. can me that?

 <!doctype html>  <?php  $servername = "localhost"; $username = "root"; $password = ""; $dbname = "db_dealer_track"; $conn = new mysqli($servername, $username, $password, $dbname);  if($conn->connect_error){ die("connection failed". $conn->connect_error); }   if(isset($_post['id1'])){  $sql = "select * tbl_dealer_info "; $sql .= "where $account_name = 'account_name' "; $result = mysqli_query($conn, $sql); while($row = mysqli_fetch_array($result)){   ?>  <html> <head> <title>imobile </title> </head> <body bgcolor = "#d6dfe3"> <center><b><h2>please enter following information: </h2></b></center>  <form action = "dealer_track.php" method = "post">  <strong><center> <u>fields marked asterisk(*) required.</u><br><br> name of dealer:* // admin selects user update  <?php  $sql = "select account_name tbl_dealer_info "; $result = mysqli_query($conn, $sql); echo "<select name = 'account_name' id = 'id'>";  echo "<option value = ''>"; while($row = mysqli_fetch_array($result)){     echo "<option value = '" .$row['account_name'] . "'>" . $row['account_name'] . "</option>"; } echo "</select>"; ?> <br><br> <input type = submit id = "id1" name = "id1" value = "display fields" /><br> </center> <hr> <br><br> </form>   <form action = "dealer_track.php" method = "post">  email:*<br>      <input type = "email" name = "email" id = "id3" value = "<?php echo $row['email']?>" required /><br><br>   rsm:*<br> <?php $sql = "select rsm_val tbl_rsm_drop_down "; $result = mysqli_query($conn, $sql); echo "<select name = 'rsm_val'>";  echo "<option value = ''></option>"; while($row = mysqli_fetch_array($result)){     echo "<option value = '" .$row['rsm_val'] . "'>" . $row['rsm_val'] . "</option>"; } echo "</select>"; ?> <br><br> **// radio buttons aren't getting checked though**  iphone boost approved:  <input type = "radio" name = "boost_app" <?php if(isset($boost_app)&& $boost_app =="yes")?> value = "yes" />yes  <input type = "radio" name = "boost_app" <?php if(isset($boost_app)&& $boost_app =="no")?> value = "no" />no<br><br> </form> <?php }}  // while loop , if loop @ start ?>  </body> </html>  

i'm taking wild guess here, i'm assuming want select user dropdown (that bad idea if many people in said database), want make simple html form , name somethign remember. under form put this?

<?php if(isset($_post['formnamehere'])) { $sql = "select * (table name) accountname=" . $accountname; $result = $conn->query($sql); $row = $result->fetch_assoc(); echo $row['accountname']; //put other things here, etc. } ?> 

granted code not meant used exactly. give general idea.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -