一种形式的2种不同的动作

时间:2016-06-11 11:13:41

标签: php forms action

我有一个名为addcustomer.php的表单。它包含firsname,lastname,mobile fields.i此表单上还有2个按钮。用于保存数据的onr按钮和用于向客户发送SMS的其他按钮。 我想当我点击第二个按钮时,3个数据字段传递给另一个名为smsinfo.php的表单。 现在用于保存数据的操作效果很好,但直接用于smsinfo。此表单上没有数据。

<form method ="POST" name = "custform" action="">
<div class="cell_2_2"><label class="lblfields">Firstname:</label>&nbsp;<input type="text" name="firstname" autocomplete="off"/></div>
<div class="cell_3_2"><label class="lblfields">Lastname :</label>&nbsp;<input type="text" name="lastname" autocomplete="off"/></div>    
<div class="cell_5_2"><label class="lblfields">Mobile :</label>&nbsp;<input type="text" name="mobile" autocomplete="off"/></div>
 <input type="submit" name="submit" value="Save"/>
 <input type="submit" name="sendsms" value="Sms"/>

if (isset($_POST['submit']))
{
Saving code here

} else if (isset($_POST['sendsms'])) {
header("Location: smsinfo.php");
}

这里是smsinfo.php的代码:

<?php
$Fname = $_REQUEST['firstname'];
$Lname = $_REQUEST['lastname'];
$Mob = $_REQUEST['mobile'];
?>
<html>
<body>
<form action="sendingsms.php" method="POST">
<input style="width: 100px;" name="firstname"  type="text" value="<?php echo $firstname; ?>"/>
 <input style="width: 100px;" name="lastname"  type="text" value="<?php echo $lastname; ?>"/>
 <input style="width: 100px;" name="mobile"  type="text" value="<?php echo $mobile; ?>"/>
</form>
</body>
</html>

感谢所有人,抱歉我的英语很差

0 个答案:

没有答案
相关问题