php jquery将post参数发送到其他php页面
我是网络技术新手,我有一些障碍 我有一个php页面,通过调用另一个php页面在JS中发送post邮件请求 但是我需要将我的邮件的值传递到新的php页面,所有这些都可以使用硬编码的VAL,但是我需要知道如何将参数传递到我的php发送邮件页面 下面是php主页的代码:php jquery将post参数发送到其他php页面,php,jquery,parameters,Php,Jquery,Parameters,我是网络技术新手,我有一些障碍 我有一个php页面,通过调用另一个php页面在JS中发送post邮件请求 但是我需要将我的邮件的值传递到新的php页面,所有这些都可以使用硬编码的VAL,但是我需要知道如何将参数传递到我的php发送邮件页面 下面是php主页的代码: <script> ... $.post( "send-mail-parklane-suscrib.php" , { name: "John", time: "2pm" }); ... </script> .
<script>
...
$.post( "send-mail-parklane-suscrib.php" , { name: "John", time: "2pm" });
...
</script>
...
$.post(“sendmailparklanescrib.php”,{name:“John”,time:“2pm”});
...
这是代码
send-mail-parklane-suscrib.php
<html>
<head><title>PHP Mail Sender</title></head>
<body>
<?php
session_start();
echo("chamb");
$to = 'juanss234@gmail.com';
$from = 'bot@parklanefinancial.com.au';
$subject = 'Parklane Financial Subscribe';
$headers = 'From: bot@parklanefinancial.com.au' . "\r\n".
'Reply-To: test@abc.com'. "\r\n".
'Return-Path: test@abc.com' . "\r\n".
'X-Mailer: PHP/' . phpversion();
$message = "SS9 tkt ss9!!!";
mail($to, $subject, $message, $headers, "-f $from");
?>
</body>
</html>
PHP邮件发送者
那么,如何在我的“发送邮件”页面上访问此VAL
谢谢 使用
$\u POST
$name=$_POST['name'] //John
等等,它们将被保存到,$\u POST
中
<?php
echo $_POST["name"]; //Echos John
echo $_POST["time"]; //Echo 2pm
/**
* You may see at anytime if your page has
* any set by: (Dev use only) Printing the contents
* of the $_POST Array.
**/
print_r( $_POST );
/**
* Note, it's important you check the existence
* & verify any values sent.
**/
if ( isset( $_POST["name"] ) && $_POST["name"] !== '' ) {
//Code
$Name = $_POST["name"];
}
?>