0

假设 index.php 在同一页面上有两个表单(form1.phpform2.php),我从 iframe 调用它们。

现在的问题是我希望在新选项卡thankyou中打开页面,这在我提供时是可能的......但是通过这样做,当任何人填写表格并输入错误的验证码时,它会将其带到 url 页面(称为如在 iframe 中)而我希望它出现在同一页面上说......它有一个很长的代码,如果有人要求我可以分享......<form target=_blankform1.phpindex.php

thank you页面顶部之前有一段很长的php代码<DOCTYPE

<?php
    session_start();

    $tuCurl = curl_init();
    curl_setopt($tuCurl, CURLOPT_URL, $url);
    curl_setopt($tuCurl, CURLOPT_RETURNTRANSFER, 1);    
    $tuData = curl_exec($tuCurl); 
    curl_close($tuCurl); 

    $userip    = explode(',',$tuData);
    $ipcountry = str_replace('"', '', $userip[3]);

    include "libmail.php";  
    $errors = '';

    if(isset($_POST['email']))
    {
        if(empty($_SESSION['6_letters_code'] ) || 
            strcasecmp($_SESSION['6_letters_code'], $_POST['captcha']) != 0)
        {
            $errors .= "You have entered wrong captcha code!";
        }
        elseif($_FILES["userfile"]["size"] > 1048576)
        {
            $errors .= "You can upload maximum of 800kb file!";
        }
        else
        {
            $name       = $_POST['name'];
            $phone      = $_POST['phone'];
            $email      = $_POST['email'];

            $captcha    = $_POST['captcha'];

            $sender     = $contact_email;

            function clean_string($string) 
            {
                $bad = array("content-type","bcc:","to:","cc:","href");
                return str_replace($bad,"",$string);
            }

            if(trim($name) !='')
                $email_message .= "Full Name: ".clean_string($name)."\n"."\n";


            if(trim($phone) !='')
                $email_message .= "Phone: ".clean_string($phone)."\n"."\n";

            $random = mt_rand();

            $m= new Mail; // create the mail
            $m->From( $name."<$email>" );
            $m->To( "abc@gmail.com" );
            $m->Subject( "Form query - ".$random ); 
            $m->Body( $email_message);

            $m->Priority(2) ;

            if($_FILES["userfile"]["tmp_name"])
            {
                move_uploaded_file($_FILES["userfile"]["tmp_name"], 'uploadedfiles/'.$_FILES["userfile"]["name"]);
                $file_upload = 'uploadedfiles/'.$_FILES["userfile"]["name"];
                $m->Attach( $file_upload) ;
            }
            $m->Send();

            header('location:thankyou.php');

            if($_FILES["userfile"]["tmp_name"])
            {
                unlink($file_upload);
            }
        }
    }


?>

现在我可以在这个 php 中给出一个 javascript 目标脚本 ..但我不知道怎么写

4

0 回答 0