Http ile sorun HTML meta etiketlerini kullanarak yönlendirme

1 Cevap php

Aşağıdaki kodu bakın

// redirect to success page 
if ($success){
 header( 'Location: ../Scripts/_lib/phpmailer-fe.php'); 
}
else{
  print "<meta http-equiv="refresh" content="0;URL=error.html">";
}

onun değil çalışma

        <form method="post" action="" enctype="multipart/form-data" name="quest">
        <input type="hidden" value="valvedevelopertool.html" name="referer">
  <table cellspacing="0" cellpadding="0"width="650" align="center">
            <tr  class="tablerow">
      <td id="apptitlebox" colspan="2"><span class="valvedevelopertitle">Valve Specification Developer Tool</span></td></tr>
</table>
<br /><br />
<p align="center">Please enter known details to help assist us in processing your enquiry accuratly and quickly.</p>
<table cellspacing="0" cellpadding="0" width="650" align="center" class="tablecontainer">
<tr>
<td class="valvedevelopertoolreftitle">Reference</td><td><input type="text" style="width:204px" class="border" name="vdt_ref"/></td><td class="valvedevelopertoolreftitle">Date</td><td><input type="text" style="width:204px" class="border" name="vdt_date"/></td>
</tr>
</table>
<br />
<table cellspacing="0" cellpadding="0" width="650" align="center" class="tablecontainer">
<tr><td class="valvedevelopertoolreftitle">Enquiry 1</td></tr>
<tr class="tablerow">
<td width="154" class="titlebg"></td><td width="243" class="valvedevelopertooltexttitle titlebg">Select Known Specifications</td><td width="99" class="valvedevelopertooltexttitle titlebg"></td>
<td width="252" class="valvedevelopertooltexttitle titlebg">Add More Detail</td>
</tr>
<tr class="tablerow">
<td class="valvedevelopertoolleft">Qty</td>
<td class="valvedevelopertooltext">
<select name="vdt_qty" id="Type" class="border" style="width:204px" onchange="qty1(document.quest.vdt_qty.value); qty2(document.quest.vdt_qty.value)">
             <option selected value="1">1</option>
              <option value="2">2</option>
              <option value="3">3</option>   
              <option value="4">4</option> 
              <option value="5">5</option>              
              <option value="10">10</option>              
              <option value="15">15</option>    
              <option value="20">20</option>              
              <option value="50">50</option> 
              <option value="100">100</option>              
              <option value="otherqty">Other (specify to the right)</option> 
</select>
</td>
<td class="valvedevelopertoolextratext"><span id="otherqtytitle" class="border"></span></td>
<td class="valvedevelopertooltext"><span id="otherqty" class="border"></span>
</td>
</tr>
<tr  class="tablerow">
<td class="valvedevelopertoolleft highlight1">Type</td>
<td class="valvedevelopertooltext highlight1">
<select name="vdt_type" id="vdt_type" class="border" style="width:204px" onchange="type1(document.quest.vdt_type.value); type2(document.quest.vdt_type.value)">
  <option selected value="">Please Select</option>
  <option value="PSV">PSV (Pressure Safety/Relief Valve)</option>  
  <option value="Controll Valve">Control Valve</option>
  <option value="Ball Valve">Ball Valve</option>
  <option value="Wedge Gate Valve">Wedge Gate Valve</option>
  <option value="Parallel Slide Gate Valve">Parallel Slide Gate Valve</option>
  <option value="Through Conduit Gate Valve">Through Conduit Gate Valve</option>
  <option value="Knife Gate Valve">Knife Gate Valve</option>
  <option value="Globe Valve">Globe Valve</option>
  <option value="checkvalve">Check Valve</option>
  <option value="Plug Valve">Plug Valve</option>
  <option value="Choke Valve">Choke Valve</option>
  <option value="Butterfly Valve">Butterfly Valve</option>
  <option value="Needle Valve">Needle Valve</option>
  <option value="Double Block/Bleed Valve">Double Block / Bleed Valve</option>
  <option value="3 Way Valve">3 Way Valve</option>
  <option value="4 Way Valve">4 Way Valve</option>      
</select></td>
<td class="valvedevelopertoolextratext highlight1"><span id="checkvalvetypetitle" class="border"></span></td>
<td class="valvedevelopertooltext highlight1"><span id="checkvalvetype" class="border"></span></td>
</tr>
<tr  class="tablerow">
<td class="valvedevelopertoolleft">Size</td>
<td class="valvedevelopertooltext">
<select name="vdt_size" id="Type" class="border" style="width:204px" onchange="size1(document.quest.vdt_size.value); size2(document.quest.vdt_size.value)">
              <option selected value="">Please Select</option>
              <option value="0.5">0.5"</option>
              <option value="1">1"</option>
              <option value="1.5">1.5"</option>  
              <option value="2">2"</option> 
              <option value="4">4"</option>              
              <option value="6">6"</option>              
              <option value="8">8"</option>    
              <option value="10">10"</option>              
              <option value="12">12"</option> 
              <option value="14">14"</option>              
              <option value="16">16"</option>              
              <option value="18">18"</option>              
              <option value="20">20"</option>              
              <option value="24">24"</option>              
              <option value="30">30"</option>              
              <option value="36">36"</option>              
              <option value="40">40"</option>              
              <option value="othersize">Other (specify to the right)</option> 
</select>
</td>
<td class="valvedevelopertoolextratext"><span id="othersizetitle" class="border"></span></td>
<td class="valvedevelopertooltext"><span id="othersize" class="border"></span></td>
</tr>
<tr  class="tablerow">
<td class="valvedevelopertoolleft highlight1">Pressure Class</td>
<td class="valvedevelopertooltext highlight1">
<select name="vdt_class" onchange="class1(document.quest.vdt_class.value); class2(document.quest.vdt_class.value)" class="border" style="width:204px">
<option value="">Please Select</option>
<option value="ANSI">ANSI</option>
<option value="PN">PN</option>
<option value="API">API</option>
</select>
</td>
<td class="valvedevelopertoolextratext highlight1" align="right"><span id="classname" class="border"></span></td>
<td class="valvedevelopertooltext highlight1"><span id="classtypes" class="border"></span></td>
</tr>
<tr  class="tablerow">
<td class="valvedevelopertoolleft">End Connections</td>
<td class="valvedevelopertooltext">
<select name="vdt_end" id="Type" class="border" style="width:204px">
              <option selected value="">Please Select</option>
              <option value="Flanged Raised Face">Flanged Raised Face</option>
              <option value="Flanged Flat Face">Flanged Flat Face</option>              
              <option value="Flanged Ring Type Joint">Flanged Ring Type Joint</option>
              <option value="Socket Weld Female">Socket Weld Female</option>
              <option value="Socket Weld Male">Socket Weld Male</option>                            
              <option value="Screwed Female">Screwed Female</option>
              <option value="Screwed Male">Screwed Male</option>                            
</select>
</td>
<td class="valvedevelopertooltext">&nbsp;</td>
<td class="valvedevelopertooltext">&nbsp;</td>
</tr>
<tr  class="tablerow">
<td class="valvedevelopertoolleft highlight1">Bore</td>
<td class="valvedevelopertooltext highlight1">
<select name="vdt_bore" id="Type" class="border" style="width:204px">
              <option selected value="">Please Select</option>
              <option value="Full">Full</option>
              <option value="Reduced">Reduced</option>
</select>

</td>
<td class="valvedevelopertooltext highlight1">&nbsp;</td>
<td class="valvedevelopertooltext highlight1">&nbsp;</td>
</tr>
<tr  class="tablerow">
<td class="valvedevelopertoolleft">Body Material</td>
<td class="valvedevelopertooltext">
<select name="vdt_body" id="Type" class="border" style="width:204px" onchange="body1(document.quest.vdt_body.value); body2(document.quest.vdt_body.value)">
              <option selected value="">Please Select</option>
              <option value="Carbon Steel">Carbon Steel</option>
              <option value="Stainless Steel">Stainless Steel</option> 
              <option value="Duplex">Duplex</option>    
              <option value="Alloy">Alloy</option>              
              <option value="Bronzes">Bronzes</option> 
              <option value="Leaded Gunmetal">Leaded Gunmetal</option>              
              <option value="Low Temp Nickel Alloy Steel">Low Temp Nickel Alloy Steel</option>              
              <option value="Titanium">Titanium</option>   
              <option value="Hastelloy">Hastelloy</option>              
              <option value="Monel">Monel</option>              
              <option value="Cast Iron">Cast Iron</option> 
</select>
</td>
<td class="valvedevelopertoolextratext"><span id="bodytitle" class="border"></span></td>
<td class="valvedevelopertooltext"><span id="bodytypes" class="border"></span></td>
</tr>
<tr  class="tablerow">
<td class="valvedevelopertoolleft highlight1">Trim Material</td>
<td class="valvedevelopertooltext highlight1">
<select name="vdt_trim" id="Type" class="border" style="width:204px" onchange="trim1(document.quest.vdt_trim.value); trim2(document.quest.vdt_trim.value)">
              <option selected value="">Please Select</option>
              <option value="Carbon Steel">Carbon Steel</option>
              <option value="Stainless Steel">Stainless Steel</option> 
              <option value="Duplex">Duplex</option>    
              <option value="Alloy">Alloy</option>   
              <option value="13% Chrome Steel">13% Chrome Steel</option> 
              <option value="Bronze and Aluminium Bronze">Bronze &amp; Aluminium Bronze</option> 
              <option value="Nickel Aluminium Bronze">Nickel Aluminium Bronze</option> 
              <option value="Leaded Gunmetal">Leaded Gunmetal</option>              
              <option value="Titanium">Titanium</option>              
              <option value="Low Temp Nickel Alloy Steel">Low Temp Nickel Alloy Steel</option>
              <option value="Monel">Monel</option>              
              <option value="Cast Iron">Cast Iron</option> 
              <option value="Ceramics">Ceramics</option>
</select>

</td>
<td class="valvedevelopertoolextratext highlight1"><span id="trimtitle" class="border"></span></td>
<td class="valvedevelopertooltext highlight1"><span id="trimtypes" class="border"></span></td>
</tr>
<tr  class="tablerow">
<td class="valvedevelopertoolleft">Seat Material</td>
<td class="valvedevelopertooltext">
<select name="vdt_seat" id="Type" class="border" style="width:204px" onchange="seat1(document.quest.vdt_seat.value); seat2(document.quest.vdt_seat.value)">
            <option selected value="">Please Select</option>
            <option value="PTFE">PTFE</option>
            <option value="Nylon">Nylon</option>
            <option value="Peek">Peek</option>
            <option value="Viton">Viton</option>                        
            <option value="Metal">Metal</option>
</select>
</td>
<td class="valvedevelopertoolextratext" align="right"><span id="seatgradetitle" class="border"></span></td>
<td class="valvedevelopertooltext"><span id="seatgrade" class="border"></span></td>
</tr>
<tr  class="tablerow">
<td class="valvedevelopertoolleft highlight1">NACE Materials</td>
<td class="valvedevelopertooltext highlight1">
<select name="vdt_nace" id="Type" class="border" style="width:204px">
            <option selected value="">Please Select</option>
            <option value="Yes">Yes</option>
            <option value="No">No</option>
</select>
</td>
<td class="valvedevelopertooltext highlight1">&nbsp;</td>
<td class="valvedevelopertooltext highlight1">&nbsp;</td>
</tr>
<tr  class="tablerow">
<td class="valvedevelopertoolleft">Operation</td>
<td class="valvedevelopertooltext">
<select name="vdt_operation" id="Type" class="border" style="width:204px"  onchange="operation1(document.quest.vdt_operation.value); operation2(document.quest.vdt_operation.value)">
            <option selected value="">Please Select</option>
            <option value="Manual Hand Lever">Manual Hand Lever</option>
            <option value="Manual Handwheel">Manual Handwheel</option>
            <option value="Manual Gearbox">Manual Gearbox</option>
            <option value="Automated/Actuated">Automated / Actuated</option>                        
            <option value="otheroperation">Other (specify to the right)</option> 
</select>
</td>
<td class="valvedevelopertoolextratext"><span id="otheroperationtitle" class="border"></span></td>
<td class="valvedevelopertooltext"><span id="otheroperation" class="border"></span>
</td>
</tr>
<tr>
<td class="valvedevelopertoolleft highlight1">Other Information</td>
<td class="valvedevelopertooltextarea highlight1" colspan="3" align="left" style="padding-left:23px; padding-top:3px; height:95px"><span class="valvedevelopertooltextarea highlight1" style="padding-top:3px; height:95px">
  <textarea name="textarea" cols="5" rows="4" class="border" style="width:550px"></textarea>
</span></td>
</tr>
</table>
<br />
<table cellspacing="0" cellpadding="0" width="650" align="center" class="tablecontainer">
<tr class="tablerow">
<td width="154" class="titlebg"></td><td width="243" class="valvedevelopertooltexttitle titlebg">Your Details</td><td width="99" class="valvedevelopertooltexttitle titlebg"></td>
<td width="252" class="valvedevelopertooltexttitle titlebg"></td>
</tr>

<tr>
<td class="valvedevelopertoolleft" width="154">Name</td>
<td class="valvedevelopertooltext" width="243"><input name="contact_name" style=" width: 200px;" type="text" maxlength="200" class="border"></td>
<td class="valvedevelopertoolextratext" width="99">&nbsp;</td>
<td class="valvedevelopertooltext" width="252">&nbsp;</td>
</tr>
<tr>
<td class="valvedevelopertoolleft highlight1" width="154">Email Address</td>
<td class="valvedevelopertooltext highlight1" width="243"><input name="contact_email" style=" width: 200px;" type="text" maxlength="200" class="border"></td>
<td class="valvedevelopertoolextratext highlight1" width="99">&nbsp;</td>
<td class="valvedevelopertooltext highlight1" width="252">&nbsp;</td>
</tr>
<tr>
<td class="valvedevelopertoolleft" width="154">Telephone Number</td>
<td class="valvedevelopertooltext" width="243"><input name="contact_tel" style=" width: 200px;" type="text" maxlength="200" class="border"></td>
<td class="valvedevelopertoolextratext" width="99">&nbsp;</td>
<td class="valvedevelopertooltext" width="252">&nbsp;</td>
</tr>
<tr>
<td class="valvedevelopertoolleft highlight1" width="154">Company</td>
<td class="valvedevelopertooltext highlight1" width="243"><input name="contact_company" style=" width: 200px;" type="text" maxlength="200" class="border"></td>
<td class="valvedevelopertoolextratext highlight1" width="99">&nbsp;</td>
<td class="valvedevelopertooltext highlight1" width="252">&nbsp;</td>
</tr>
</table>
<br />
<table cellspacing="0" cellpadding="0" width="650" align="center" class="tablecontainer">
<tr>
<td colspan="4">
<?php
                    # Get the reCAPTCHA library
                    require_once('../recaptcha/recaptchalib.php');

                    # These are /not/ real keys - you must replace them with your *own* keys
                    # obtained from http://recaptcha.net/api/getkey
                    define('PUBLIC_KEY',  '[MY PUBLIC KEY]');
                    define('PRIVATE_KEY', '[MY PRIVATE KEY]');

                    # Did the user fail the captcha test?
                    $error = null;

                    # This is where we process the user's response. We don't
                    # do this when the form is initially displayed - only
                    # when the user submits it.
                    if ($_POST["recaptcha_response_field"]) {
                        $response = recaptcha_check_answer( 
                            PRIVATE_KEY, $_SERVER['REMOTE_ADDR'],
                            $_POST['recaptcha_challenge_field'],
                            $_POST['recaptcha_response_field']
                        );

                        if ( $response->is_valid ) {

// get posted data into local variables
$EmailFrom = Trim(stripslashes($_POST['vdt_type'])); 
$EmailTo = "MAIL@MAIL.COM";

// validation
$validationOK=true;
if (Trim($EmailFrom)=="") $validationOK=false;
if (!$validationOK) {
print '<meta http-equiv="refresh" content="0;URL=error.html">';
  exit;
}

// prepare email body text
$Body = "";
$Body .= "Name: ";
$Body .= $Name;
$Body .= "n";
$Body .= "n";
$Body .= "Email: ";
$Body .= $EmailFrom;
$Body .= "n";
$Body .= "n";
$Body .= "Company: ";
$Body .= $Company;
$Body .= "n";
$Body .= "n";
$Body .= "Telephone: ";
$Body .= $Telephone;
$Body .= "n";
$Body .= "n";
$Body .= "Fax: ";
$Body .= $Fax;
$Body .= "n";
$Body .= "n";
$Body .= "Location: ";
$Body .= $Location;
$Body .= "n";
$Body .= "n";
$Body .= "How Did You Hear About Us: ";
$Body .= $HowDidYouHearAboutUs;
$Body .= "n";
$Body .= "n";
$Body .= "Enquiry Type: ";
$Body .= $EnquiryType;
$Body .= "n";
$Body .= "n";
$Body .= "Comments: ";
$Body .= $Comments;
$Body .= "n";
$Body .= "n";
$Body .= "Join Mailing List: ";
$Body .= $MailingList;
$Body .= "n";



// send email 
$success = mail($EmailTo, $Subject, $Body, "From: noreply@score-training.com");

// redirect to success page 
if ($success){
if (isset($_POST['submit'])) {
header ("Location: ../Scripts/_lib/phpmailer-fe.php");
}
else{
  print '<meta http-equiv="refresh" content="0;URL=error.html">';
}
}
                            # For example
                            # ... validate user input ...
                            # ... store form data in a database ...
                            # ... redirect to 'thank you' page

                        }
                        else {
                            # The user failed the reCAPTCHA test so we need
                            # to fill in the error message and re-try the
                            # form submission
                            $error = $response->error;
                        }
                    }

                    # Display the reCAPTCHA challenge. The first time
                    # through $error will be null. 

                    echo recaptcha_get_html( PUBLIC_KEY, $error );
                ?>

</td></tr>
<tr>
<td colspan="4" align="center"><input type="submit" value="Submit Enquiry" class="border" name="submit">&nbsp;<input type="reset" value="Clear Form" class="border"></td>
</tr>
</table>
</form>

1 Cevap

Sen yanlış bir şekilde dize şahsın. Tek tırnak içinde saklanması:

print '<meta http-equiv="refresh" content="0;URL=error.html">';

Eğer iyi dizim (o bile söz sözdizimi vurgulayıcı görülebilir) sağlayan herhangi bir editör ile bu tür hataları bulmak gerekir.

I don't know whether this solves the problem, you don't give enough information.

Ayrıca uygun Wikipedia, ferahlatıcı bu yöntem olduğuna dikkat deprecated.


Eğer HTTP 1.1 kullanıyorsanız, URL sağlanan Location must be absolute:

Not: HTTP/1.1 »Location argüman olarak bir mutlak URI gerektirir: şema, konak ismi ve mutlak yolu da dahil olmak üzere, ancak bazı müşteriler göreli tanım kabul. Genellikle $_SERVER['HTTP_HOST'], $_SERVER['PHP_SELF'] kullanabilir ve dirname() göreceli bir birinden mutlak bir URI kendiniz yapmak.