【发布时间】:2016-03-30 15:39:35
【问题描述】:
我有从其他页面获取变量的 php 表单。代码如下:
<?php
$fname = "$_POST[fname]";
$lname = "$_POST[lname]";
//these value getting from another form
?>
<form action="test.php" method="post" class="form-inline vh_pre_reg_form">
<!-- Now I want to send them by this form-->
<div class="form-group">
<label>First Name</label>
<span><?php echo $fname; ?></span>
</div>
<div class="form-group">
<label>Last Name</label>
<span><?php echo $lname; ?></span>
</div>
<input name="submit" id="btnValidate" type="submit" value="Submit"/>
</form>
我希望,当我按下提交按钮时,这些将在操作页面 test.php 和 test.php 页面,我的值将在 mysql 数据库 上回显或插入,但我无法在 test 上回显或插入到 mysql 查询它们.php我的test.php页面代码如下:
<?php
if(count($_POST)>0) {
/* Validation to check if Terms and Conditions are accepted */
if(!isset($_POST["submit"])) {
$message = "<h1>404 error !</h1><br /> <h2>Page not found !</h2>";
}
if(!isset($message)) {
echo "I got submit butt press";
echo "<br />";
echo "here is the value : ".$_POST['$fname'];
}
}
?>
请解决我的问题,如果可能的话,给我完整的代码..
【问题讨论】:
-
但是form中没有f_name和l_name的字段...;
标签: php mysql html forms submit