Php 将变量值传递给URL
我想将Php 将变量值传递给URL,php,html,Php,Html,我想将变量值传递给url,但问题是,当我第一次单击搜索按钮时,该值没有出现,当第二次单击被触发时,会显示变量值。我怎样才能解决这个问题?我想故障是当我单击搜索按钮时,页面正在刷新。有人能帮我吗 这是我的密码: <div class="form-inline form-padding"> <form action="student.php?classid=<?php echo $classid;?>" method="post
变量
值传递给url,但问题是,当我第一次单击搜索按钮时,该值没有出现,当第二次单击被触发时,会显示变量
值。我怎样才能解决这个问题?我想故障是当我单击搜索按钮时,页面正在刷新。有人能帮我吗
这是我的密码:
<div class="form-inline form-padding">
<form action="student.php?classid=<?php echo $classid;?>" method="post">
<input type="text" class="form-control" name="search" placeholder="Search by ID or Name">
<select name="subject" class="form-control" required>
<option value="">Select Subject...</option>
<?php while($row = mysql_fetch_array($mysubject)): ?>
<option value="<?php echo $row['id']?>" <?php if($row['id']==$classid) echo 'selected'; ?>><?php echo $row['subject'];?></option>
<?php endwhile; ?>
</select>
<button type="submit" name="submit" id="submit" class="btn btn-primary"><i class="fa fa-search"></i> Search</button>
<a href="print.php?classid=<?php echo $classid; ?>" target="_blank"><button type="button" name="submit" class="btn btn-success"><i class="fa fa-print"></i> Print</button></a>
</form>
</div>
在你的
<form action="student.php?classid=<?php echo $classid;?>" method="post">
这意味着首先单击您的$classid
变量的值为空,然后才为其分配一些post值。为什么不尝试post请求,然后在php中获取数据?为什么不使用“GET”方法发送值url?我想将值传递到url为什么要删除classid?您有a href。如果您说a href标记是将值传递给student.php的标记
<form action="student.php" method="post">