简体   繁体   English

PHP 表单重定向到网页

[英]PHP form redirect to a webpage

I have an entry form that needs to redirect to a payment page, which I'm struggling to sort, here is my code:我有一个需要重定向到付款页面的输入表单,我正在努力对其进行排序,这是我的代码:

if(mail($recipient, $subject, $email_content, $email_headers)) {
        // Set a 200 (okay) response code.
         http_response_code(200);
        echo "Thank You For Entering. You need to make a payment now"; 

and this is what I want it to do:这就是我想要它做的:

if(mail($recipient, $subject, $email_content, $email_headers)) {
        // Set a 200 (okay) response code.
         http_response_code(301); window.location='payment.html');

I know the below code won't work, I just can't see to code it correctly?我知道下面的代码不起作用,我只是看不到正确编码?

Is it possible?是否可以?

use header function使用标题功能

if(@mail($recipient, $subject, $email_content, $email_headers)) {
            // Set a 200 (okay) response code.
             http_response_code(301); 
    header('location: http://yourdomain.com/payment.html');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM