1
我在表格下面的代碼:PHP的郵件功能(兩個按鈕?)
<form action="mail.php" method="POST">
有沒有辦法添加另一個提交按鈕,讓PHP的知道,如果使用按鈕1它的數據發送到mail.php while is button two is used it send the data to mail2.php?
感謝您的幫助
我在表格下面的代碼:PHP的郵件功能(兩個按鈕?)
<form action="mail.php" method="POST">
有沒有辦法添加另一個提交按鈕,讓PHP的知道,如果使用按鈕1它的數據發送到mail.php while is button two is used it send the data to mail2.php?
感謝您的幫助
這將是正確使用單選按鈕的值,傳遞參數選項,如:
<input type="radio" name="how" value="mail1" id="radio1"><label for="radio1">Name of parameter1</label>
<input type="radio" name="how" value="mail2" id="radio2"><label for="radio2">Name of parameter2</label>
,並在服務器上:
$mail = $_POST['how']==mail1?'mail1':'mail2';
include($mail.'.php');
不是沒有一些JavaScript。但是你可以很容易地創建兩個指向這兩個腳本的表單。或者讓服務器上的一個php腳本找出哪個按鈕被按下,然後在那裏運行相應的代碼。 'if($ _POST ['submit'] =='mail2'){include('mail2.php'); }' –
@rid:我明白了,JavaScript就是這樣。 –
@MarcB:謝謝:) –