简体   繁体   中英

jquery wont pick the dynamically populated dropdown select box values

i have an issue with jquery and php my problem is this:

i have used jquery .post method to send data to an external php page which then returns data from the page successfully however i load these values (which are options with option tags) into select elements which i then want to use those values in another .post request that sends them to the same external php page that deals with it differently in an if statement that determines if it is set however the main issue i ave is

why does it jump to the else and display an echo message from the php page

eg. dynamically sent options in php page

  while($fetch = mysql_fetch_array($sel2))
  {                 
  $options = "<option value=".$fetch['amount'].">" . $fetch['amount'] . "</option>";
  echo $options;
  }

i have 2 drop downs populated by external database with values in them and options however it doesnt pick the values up on the external php page

 if(isset($_POST['c']))
 {
$c = $_POST['c'];
discounts($c);
 }
 else
 {
$msg = "nothing entered!!";
$msg2 = 1;
$array = array($msg,$msg2);
$sent = implode(",",$array);
echo $sent; 
 }

can anyone tell me why it doesnt pick the value up?

id do it like this in html?

<select id="options" name="optionsselect">
  <?php foreach($fetch as $whatever) : ?>
     <option value="<?=$whatever['amount'];?>"<?=$selected?>><?=$whatever['amount'];?></option>
  <?php endforeach; ?></select>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM