Php 表单使用方法get而不是post重定向
我有一个名为contact.php的文件,里面有表单:Php 表单使用方法get而不是post重定向,php,Php,我有一个名为contact.php的文件,里面有表单: <form method="post" name="kontakt" action="send_mail.php"> <fieldset class="formularz_kontaktowy"> <legend>Formularz kontaktowy</legend> <div><label id="lblStatus"></label&g
<form method="post" name="kontakt" action="send_mail.php">
<fieldset class="formularz_kontaktowy">
<legend>Formularz kontaktowy</legend>
<div><label id="lblStatus"></label></div>
<div><input type="text" name="txtName" title="Imię i nazwisko" id="txtName" class="text"></div>
<div><input type="text" name="txtEmail" title="Email" id="txtEmail" class="text"></div>
<div><input type="text" name="txtTitle" title="Tytuł" id="txtTitle" class="text"></div>
<div><textarea cols="30" rows="10" name="txtMessage" id="txtMessage" class="text" title="Treść wiadomości"></textarea></div>
<input type="submit" name="btnSendmail" value=Send">
</fieldset>
</form>
在浏览器中单击btnSendmail后,我有了URL,例如:localhost/contact.php?txtName=Mary+Smith&txtmail=mailMail%40gmail.com&txtitle=dfd&txtMessage=fgdf&btnSendmail=Send,但我认为应该是localhost/Send\u mail.php。原因是什么
编辑:send_mail.php
<?php
require_once "Mail.php";
$from = "<mailaddress@gmail.com>";
$to = "<mail2@gmail.com>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "ssl://smtp.gmail.com";
$port = "465";
$username = "<mailaddress@gmail.com>";
$password = "password";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
?>
我无法重现这个问题。send_mail.php服务器端是否发生了某些事情,该服务器端正在使用查询字符串值将浏览器转发到该地址?同意。url至少是可疑的和用户创建的,可能是send_mail.php.Please的结果。我添加了send_mail.php代码,更改了邮件数据。正如你所看到的,它应该发送邮件,但它不工作。