php - Display drowdown values after user has selected 3 option -


i have 3 drop downs want display whatever user select after he/she has selected function or scrpt must within script

<?php $resource_names = mysql_query("select distinct name selections order id asc"); $names = array(); while($row = mysql_fetch_row($resource_names)){     $names[] = $row[0]     }  $resource_surnames = mysql_query("select distinct surname selections order id asc");  $surnames = array(); while($row = mysql_fetch_row($resource_surnames)){     $surnames[] = $row[0]; }  $resource_emails   = mysql_query("select distinct email selections order id asc");     $emails = array(); while($row = mysql_fetch_row($resource_emails)){     $emails[] = $row[0]; } if(count($emails) <= 0 || count($surnames) <= 0 || count($emails) <= 0){     echo 'no results have been found.'; } else {      // display form     echo '<form name="form" method="post" action="test.php">';      //names dropdown:     echo '<select name="id" id="names">';     foreach($names $name) echo "<option id='$name'>$name</option>";     echo '</select>';      //surnames dropdown     echo '<select name="id" id="surnames">';     foreach($surnames $surname) echo "<option id='$surname'>$surname</option>";     echo '</select>';      //emails dropdown     echo '<select name="id" id="emails">';     foreach($emails $email) echo "<option id='$email'>$email</option>";     echo '</select>';      echo "<button id='write_in_div'>click me!</button>";      echo '</form>';  } ?> 

something call write_in_div when click me! button press or other method can used display 3 selection user selected

the output should select 1) name 2)surname , email

you have error in html selects each select has same name "id" each need unique can detect then.

you need detect if user has submitted form

if(isset($_post["select_name"])) {      echo $_post["select_name"]; } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -