我对jquery和php有问题,我的问题是这样的:
我使用 jQuery .post 方法将数据发送到外部 PHP 页面,然后该页面成功从页面返回数据,但是我将这些值(带有选项标签的选项)加载到选择元素中,然后我想在另一个 .post 请求中使用这些值,该请求将它们发送到同一个外部 PHP 页面,该页面在 if 语句中以不同的方式处理它,该语句确定它是否被设置,但主要我所关注的问题是
为什么它会跳转到 else 并显示来自 PHP 页面的回显消息
例如PHP 页面中的动态发送选项
while($fetch = mysql_fetch_array($sel2))
{
$options = "<option value=".$fetch['amount'].">" . $fetch['amount'] . "</option>";
echo $options;
}
我有 2 个由外部数据库填充的下拉列表,其中包含值和选项,但它不会在外部 PHP 页面上选取值
if(isset($_POST['c']))
{
$c = $_POST['c'];
discounts($c);
}
else
{
$msg = "nothing entered!!";
$msg2 = 1;
$array = array($msg,$msg2);
$sent = implode(",",$array);
echo $sent;
}
谁能告诉我为什么它没有升值?
id 在 html 中这样做吗?
<select id="options" name="optionsselect">
<?php foreach($fetch as $whatever) : ?>
<option value="<?=$whatever['amount'];?>"<?=$selected?>><?=$whatever['amount'];?></option>
<?php endforeach; ?></select>