2013-04-09 35 views
1

我有這種形式,直到幾天前它工作正常,現在它顯示「地址所需」,無論在地址輸入字段。php form給出錯

下面是我使用的表單的代碼。

isset($_POST['d1_add'])   

這是如果(空語句:

if (!empty($_POST)) { 
echo "   <ul>\n"; 
    if(empty($d1_fname)) {echo "   <li>First Name Required</li>\n";}else{$complete = $complete + 1;} 
    if(empty($d1_lname)) {echo "   <li>Last Name Required</li>\n";}else{$complete = $complete + 1;} 
    if(empty($d1_add))  {echo "   <li>Address Required</li>\n";}else{$complete = $complete + 1;} 
    if(empty($d1_city))  {echo "   <li>City  Required</li>\n";}else{$complete = $complete + 1;} 
    if($d1_state=="STATE") {echo "   <li>State Required</li>\n";}else{$complete = $complete + 1;} 
    if(empty($d1_zip))  {echo "   <li>Zip Code Required</li>\n";}else{$complete = $complete + 1;} 
    if(empty($d1_county)) {echo "   <li>County Required</li>\n";}else{$complete = $complete + 1;} 
    if(empty($d1_email)) {echo "   <li>E-Mail Required</li>\n";}else{$complete = $complete + 1;} 
    if(empty($d1_phone1) || empty($d1_phone2) ||empty($d1_phone3)) 
         {echo "   <li>Phone Number Required</li>\n";}else{$complete = $complete + 1;} 
    if(empty($d1_contact)) {echo "   <li>Preferred Contact Required</li>\n";}else{$complete = $complete + 1;} 

這是組成部分:

<td>Street Address</td> 
<td><input style="background-color: #FEFEB6;" name="d1_add" size="20" type="text" 
<?php if(!empty($d1_add)){echo 'value="'.$d1_add.'" ';} ?>/></td> 

我的URL也過期前幾天,可這引起我的驗證碼鍵失敗了嗎?還是有其他原因會導致混亂?我很長一段時間沒有碰過這個網站,也沒有任何改變。

這是否有任何理由可以打破錶格無效的形式?

此外,如果您需要我發佈我所有的代碼,我只需在必要時拉出我假定的部分。

也是搞砸了網頁的網址是: https://www.mymra.com/Motorcycle_Insurance_Quote.php

我的所有代碼:

<?php 
    function setinclude(){ 
     $levels = substr_count($_SERVER['PHP_SELF'],'/'); 
     $root = ''; 
     for($i = 1; $i < $levels; $i++){$root .= '../';} 
     set_include_path($root); 
    }  
    setinclude(); 
    session_start(); 
    include 'site/config.php'; 
    require_once 'site/inc/smtpmail.php'; 
    $linkedURL = $secureURL; 

if (!isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'on') { 
    header('Location: '.$secureURL.'/Motorcycle_Insurance_Quote.php'); 
} 


    //require_once('site/inc/recaptchalib.php'); 
    //$recaptcha_publickey = '6Le2lt8SAAAAANUh2Qlb0ncvg7pGB79eP52ijeXV'; 
    //$recaptcha_privatekey = '6Le2lt8SAAAAAMSkGyo0HHV8hhcL7PWWm3fVN90d'; 


if (
isset($_POST['d1_fname'])   || isset($_POST['d1_lname']) || 
isset($_POST['d1_mname'])   || isset($_POST['d1_sname']) || 
isset($_POST['d1_add'])    || 
isset($_POST['d1_city'])   || isset($_POST['d1_state']) || isset($_POST['d1_zip'])  || 
isset($_POST['d1_county'])   || 
isset($_POST['d1_phone1'])   || isset($_POST['d1_phone2']) || isset($_POST['d1_phone3']) || 
isset($_POST['d1_email'])   || 
isset($_POST['d1_contact']) 
    ) { 

     // Reverse magic_quotes_gpc/magic_quotes_sybase effects on those vars if ON. 
     if(get_magic_quotes_gpc()) { 
      if(ini_get('magic_quotes_sybase')) { 
       $d1_fname   = str_replace("''", "'", $_POST['d1_fname']); 
       $d1_lname   = str_replace("''", "'", $_POST['d1_lname']); 
       $d1_mname   = str_replace("''", "'", $_POST['d1_mname']); 
       $d1_sname   = str_replace("''", "'", $_POST['d1_sname']); 
       $d1_add    = str_replace("''", "'", $_POST['d1_add']); 
       $d1_city   = str_replace("''", "'", $_POST['d1_city']); 
       $d1_state   = str_replace("''", "'", $_POST['d1_state']); 
       $d1_zip    = str_replace("''", "'", $_POST['d1_zip']); 
       $d1_county   = str_replace("''", "'", $_POST['d1_county']); 
       $d1_phone1   = str_replace("''", "'", $_POST['d1_phone1']); 
       $d1_phone2   = str_replace("''", "'", $_POST['d1_phone2']); 
       $d1_phone3   = str_replace("''", "'", $_POST['d1_phone3']); 
       $d1_email   = str_replace("''", "'", $_POST['d1_email']); 
       $d1_contact   = str_replace("''", "'", $_POST['d1_contact']); 
      } else { 
       $d1_fname   = stripslashes($_POST['d1_fname']); 
       $d1_lname   = stripslashes($_POST['d1_lname']); 
       $d1_mname   = stripslashes($_POST['d1_mname']); 
       $d1_sname   = stripslashes($_POST['d1_sname']); 
       $d1_add    = stripslashes($_POST['d1_add']); 
       $d1_city   = stripslashes($_POST['d1_city']); 
       $d1_state   = stripslashes($_POST['d1_state']); 
       $d1_zip    = stripslashes($_POST['d1_zip']); 
       $d1_county   = stripslashes($_POST['d1_county']); 
       $d1_phone1   = stripslashes($_POST['d1_phone1']); 
       $d1_phone2   = stripslashes($_POST['d1_phone2']); 
       $d1_phone3   = stripslashes($_POST['d1_phone3']); 
       $d1_email   = stripslashes($_POST['d1_email']); 
       $d1_contact   = stripslashes($_POST['d1_contact']); 
      } 
     } else { 
       $d1_fname   = $_POST['d1_fname']; 
       $d1_lname   = $_POST['d1_lname']; 
       $d1_mname   = $_POST['d1_mname']; 
       $d1_sname   = $_POST['d1_sname']; 
       $d1_city   = $_POST['d1_city']; 
       $d1_state   = $_POST['d1_state']; 
       $d1_zip    = $_POST['d1_zip']; 
       $d1_county   = $_POST['d1_county']; 
       $d1_phone1   = $_POST['d1_phone1']; 
       $d1_phone2   = $_POST['d1_phone2']; 
       $d1_phone3   = $_POST['d1_phone3']; 
       $d1_email   = $_POST['d1_email']; 
       $d1_contact   = $_POST['d1_contact']; 
     }   
     } 

include 'site/inc/www2-metas.php'; 
?> 

<title>Free Motorcycle Insurance Quote - Affordable Motorcycle Insurance</title> 
<meta name="description" content="Get your Free Motorcycle Insurance Quote from the Motorcycle Professionals at the MRA (Motorcycle Riders Association). We will quote you with several different companies and get you the best rate."> 
<meta name="keywords" content="Harley-Davidson, Harley Davidson, Motorcycle Motorclub, motorcycle insurance, motorcycle towing, biker, motorcycle, harley, davidson, sportbike,sportbikes,motorcycle club,motorcycle organization,motorcycle,organizations,motorcycle clubs,motorcycle association,motorcycle associations,motorcycle tour,motorcycle tours,motorcycle touring,motorcycle rider,motorcycle riders,motorcycle stuff,motorcycle event,motorcycle events,honda motorcycle,honda motorcycles,honda,bmw,bmw motorcycle,bmw motorcycles,bmw insurance,honda insurance,yamaha,yamaha motorcycle,yamaha motorcycles,yamahas,yamaha insurance,kawasaki,kawasaki motorcycle,kawasaki motorcycles,kawasaki insurance,kawasaki sportbikes,kawasaki sportbike,crotch rocket,crotch rockets,crotch rockets,rice burner,rice rocket,dirt bike,dirtbike,dirt bikes,dirtbikes,motocross,motorcross,daytona,daytona beach,bike week,bikeweek,daytona beach bikeweek,daytona beach bike week,daytona beach harley davidson,daytona beach harley-davidson,daytona beach harley,bike shop,bike shops,harley shop,harley shops,indian,indian motorcycle,indian motorcycles,boot hill,boothill,daytona boothill,daytona boot hill,daytona boot hill,boot hill saloon,froggy,froggy's,daytona froggy's,motorcycle racing,motorcycle races,motorcycle drag strip,motorcycle drags,ahdra,all harley drag racing association,aaa,triple a,roadside assistance,towing,big dog motorcycles,big dog,boss hoss,boss hoss motorcycles,suzuki,suzuki motorcyles,suzuki parts,suzuki shop,volusia,volusia motorcycle,volusia motorcycles,suzuki volusia,v-star,v star,yamaha v-star,road star,yamaha road star,v-star motorcycles,v-star motorcycle,v star motorcycle,v star motorcycles,gold wing,goldwing,honda goldwing,honda gold wing,gold wing motorcycles,gold wing motorcycle,Goldwing motorcycle,goldwing motorcycles,honda hoot,wing ding,honda wing ding,sturgis,sturgis south dakota,sturgis rally,sturgis rally and races,black hills rally,black hills south dakota,laconia,laconia races,myrtle beach bike week,myrtle beach bikeweek,myrtle beach,deal's gap,deals gap,motorcycle rally,motorcycle rallys,motorcycle show,bike show,flat track,flat track racing,arlen ness,ness,arlen ness motorcycles,jesse james,jesse james motorcycles,west coast,westcoast,westcoast choppers,west coast choppers,easy rider,ez rider,choppers,chopper,perowitz,dave perowitz,dave perowitz motorcycles,nhra drag racing,nhra motorcycle,harley pipes,harley parts,vance & hines,triumph,triumph,motorcycles,corbin,corbin seats,motorcycle safety foundation,trikes,progressive,progressive motorcycle insurance,aprilia,aprilia motorcycles,v-rod,v rod harley v rod,harley v-rod,harley davidson v rod,harley davidson v-rod,fatboy,fat boy,harley fatboy,harley fat boy,softtail,harley softtail,harley davidson softtail,heritage softtail,harley heritage softtail,harley davidson heritage softtail,vulcan,kawasaki vulcan,geico,geico direct,geico motorcycle insurance,dairyland,dairyland motorcycle insurance,road king,roadking,harley road king,harley roadking,harley davidson road king,harley davidson roadking,corbin motorcycle seats,sportster,sporty,harley sportster,harley davidson sportster,883,harley 883,harley davidson 883,harley-davidson 883,ama,american motorcycle association,speedvision,american thunder,high octane,american iron,motorcycle tour & cruiser,cyril huze,cyril huze motorcycles,bikers choice,custom chrome,chrome specialties,chrome specialties inc,drag specialties,performance machine,kuryakyn,sampson,paul yaffe originals,paul yaffe,cycle shack,buell,buell motorcycles,victory,victory motorcycles,ultra,ultra motorcycles,thunder motorcycles,white brothers,screamin' eagle,screamin' eagle parts,thunder cycle,surgical steeds,pro-one,pro-one motorcycles,pure steel,pure steel motorcycles,confederate motorcycles,exile,exile cycles,california customs,california custom motorcycles,bourget's bike works,bourget's motorcycles,boar motor company,american iron horse,v twin,j&p cycles,barnetts harley davidson,barnetts harley-davidson,motorcycle tires,harley tires,harley davidson tires,firebolt,buell firebolt,hayabusa,hayabusa motorcycles,cycle world,bsa,bsa motorcycles,norton,norton motorcycles,ktm,ktm motorcycles,motorcycle events,bike nights,bikenights,motorcycle bikenights,pastrana,travis pastrana,biketoberfest,loughlin,loughlin river run,americade,rainsuits,rain suits,classic,h-d,shadow,honda shadow,shadow motorcycle,blue ridge,blue ridge parkway,blue ridge touring,blue ridge tours,blue ridge mountains,gilleys pub,gilleys pub 44,cabbage patch,broken spoke,broken spoke saloon,excelsior,excelsior-henderson,escelsior motorcycles,ride to the wall,helmet laws,swingarm,motorcycle runs,s&s cycle,toy run,toy runs,abate,hells angels,gwrra,goldwing roadriders,association,goldwing road riders association,southern cruisers,southern cruisers motorcycle club,blue knights,blue knights motorcycle club,las vegas bike week,hollister races,dyna,dyna lowrider,dyna super glide,harley dyna super glide,harley dyna lowrider,harley dyna,harley davidson dyna,harley davidson,dyna super glide,harley davidson dyna lowrider,buell lightning,buell cyclone,american iron magazine,hot bike,hot bike magazine,v twin magazine,rolling thunder,walnecks,shovelhead,panhead,knucklehead,evo,evolution,revolution,harley shovelhead,harley panhead,harley knucklehead,harley evo,harley evolution,weanie bite,peter fonda,willie g,willie g davidson,lorenzo lamas,shaquille o'neal,jay leno,shaq,evil knievel,robbie knievel,bubba blackwell,hulk hogan,hulkster,born to ride,btr,full throttle,full throttle magazine,poker run,poker runs,handlebar,ron simms,ron simms motorcycles,helmets,motorcycle helmets,bubbs,bubbs pipes,bubbs motorcycle pipes,titan,titan motorcycles,titan motorcycle,indian chief,indian scout,hawk,honda hawk,rebel,honda rebel,tow truck,flat bed,millers,millers motorcycle parts,millers daytona,millers daytona beach"> 

<?php include 'site/inc/www2-css.php'; ?> 
<link rel="stylesheet" href="<?php echo $linkedURL; ?>/site/quote.css" type="text/css" media="screen" /> 

</head> 
<body> 
<?php include 'site/inc/www2-header-insurance.php'; ?> 
    <div id="body"> 
     <div id="quote"> 
     <img src="<?php echo $linkedURL; ?>/images/motorcycle-insurance-quote.jpg" alt="free motorcycle insurance quote" /> 
      <div class="errors"> 
<?php 
//Check Required Information 
if (!empty($_POST)) { 
echo "   <ul>\n"; 
    if(empty($d1_fname)) {echo "   <li>First Name Required</li>\n";}else{$complete = $complete + 1;} 
    if(empty($d1_lname)) {echo "   <li>Last Name Required</li>\n";}else{$complete = $complete + 1;} 
    if(empty($d1_add))  {echo "   <li>Address Required</li>\n";}else{$complete = $complete + 1;} 
    if(empty($d1_city))  {echo "   <li>City Required</li>\n";}else{$complete = $complete + 1;} 
    if($d1_state=="STATE") {echo "   <li>State Required</li>\n";}else{$complete = $complete + 1;} 
    if(empty($d1_zip))  {echo "   <li>Zip Code Required</li>\n";}else{$complete = $complete + 1;} 
    if(empty($d1_county)) {echo "   <li>County Required</li>\n";}else{$complete = $complete + 1;} 
    if(empty($d1_email)) {echo "   <li>E-Mail Required</li>\n";}else{$complete = $complete + 1;} 
    if(empty($d1_phone1) || empty($d1_phone2) ||empty($d1_phone3)) 
          {echo "   <li>Phone Number Required</li>\n";}else{$complete = $complete + 1;} 
    if(empty($d1_contact)) {echo "   <li>Preferred Contact Required</li>\n";}else{$complete = $complete + 1;} 

    //////// 
    // Check reCAPTCHA and hook into pre existing bad system. 
    $resp = recaptcha_check_answer ($recaptcha_privatekey, 
            $_SERVER["REMOTE_ADDR"], 
           $_POST["recaptcha_challenge_field"], 
           $_POST["recaptcha_response_field"]); 

    // this is where the hook into the bad system comes into play 
    if(!$resp->is_valid) { echo "   <li>The reCAPTCHA wasn't entered correctly.</li>\n"; } else { $complete += 1; } 
    //////// 

    if($complete==11){ 
    date_default_timezone_set('EST'); 
    $added = $updated = date('YmdHis'); 
    $d1_phone = $d1_phone1.'-'.$d1_phone2.'-'.$d1_phone3; 
    // Connect 
    include 'site/db/MCMonsterNetwork-db.php'; 
    $link = mysql_connect("$db_host", "$db_user", "$db_pass"); 

    $select = mysql_select_db("$db_name", $link); 

    if(!is_resource($link)) { 

     echo "Failed to connect to the server"; 

    } elseif(!$select) { 

     echo "Failed to select database"; 

    }else{ 
     // Make a safe query 
     $query = sprintf("INSERT INTO quotes 
         (d1_contact, d1_fname, d1_mname, d1_lname, d1_sname, d1_add, d1_city, d1_state, d1_zip, d1_county, d1_email, d1_phone, added, updated) 
       VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", 
        mysql_real_escape_string($d1_contact), 
        mysql_real_escape_string($d1_fname), 
        mysql_real_escape_string($d1_mname), 
        mysql_real_escape_string($d1_lname), 
        mysql_real_escape_string($d1_sname), 
        mysql_real_escape_string($d1_add), 
        mysql_real_escape_string($d1_city), 
        mysql_real_escape_string($d1_state), 
        mysql_real_escape_string($d1_zip), 
        mysql_real_escape_string($d1_county), 
        mysql_real_escape_string($d1_email), 
        mysql_real_escape_string($d1_phone), 
        mysql_real_escape_string($added), 
        mysql_real_escape_string($updated) 
        ); 

     mysql_query($query, $link); 
     echo mysql_error(); 

    $_SESSION['id'] = mysql_insert_id(); 
    $_SESSION['veh'] = 1; 

$message =" 
     Name: 
     $d1_fname $d1_lname 

     Email: 
     $d1_email 

     Address:   
     $d1_add 
     $d1_city, $d1_state $d1_zip 

     Phone: 
     $d1_phone 
"; 

    //mail("[email protected]", "Motorcycle Insurance Quote - $d1_fname $d1_lname", $message, "From: $d1_email"); 
    smtpmail("[email protected]", "Motorcycle Insurance Quote - $d1_fname $d1_lname", $message, "From: MyMRA.com <[email protected]>\r\nReply-To: $d1_email\r\n"); 


    echo ' 
    <script language=javascript> 
    setTimeout("location.href=\''.$secureURL.'/quote/Vehicles.php\'", 0000); 
    </script> 

    <center><b>If You are not redirected in 5 seconds <a href="'.$secureURL.'/quote/Vehicles.php">click here</a>.</b></center> 
    '; 
    } 
} 
} 
?> 
      </div> 
     <div id="quotebar"> 
     <ul> 
      <li class="current">Information</li> 
      <li>Vehicles</li> 
      <li>Drivers</li> 
      <li>Incidents</li> 
      <li>Additional Info</li> 
      <li>Complete</li> 
     </ul> 
     </div><!--close quotebar--> 
     <div id="quotebox"> 
     <form action="<?php echo $secureURL; ?>/Motorcycle_Insurance_Quote.php" method="POST"> 
     <table border="0" width="100%" cellspacing="0" cellpadding="2"> 
      <tr> 
      <td>First Name</td> 
      <td><input style="background-color: #FEFEB6;" style="background-color: #FEFEB6;" name="d1_fname" size="15" type="text" <?php if(!empty($d1_fname)){echo 'value="'.$d1_fname.'" ';} ?> /></td> 
      <td>Middle Initial</td> 
      <td><input name="d1_mname" size="1" type="text" <?php if(!empty($d1_mname)){echo 'value="'.$d1_mname.'" ';} ?> /></td> 
      </tr> 
      <tr> 
      <td>Last Name</td> 
      <td><input style="background-color: #FEFEB6;" name="d1_lname" size="20" type="text" <?php if(!empty($d1_lname)){echo 'value="'.$d1_lname.'" ';} ?> /></td> 
      <td>Suffix</td> 
      <td> 
      <select name="d1_sname"> 
       <option></option> 
       <option value="Jr"<?php if($d1_sname=="Jr"){echo ' selected="selected"';} ?>>Jr</option> 
       <option value="Sr"<?php if($d1_sname=="Sr"){echo ' selected="selected"';} ?>>Sr</option> 
       <option value="I"<?php if($d1_sname=="I"){echo ' selected="selected"';} ?>>I</option> 
       <option value="II"<?php if($d1_sname=="II"){echo ' selected="selected"';} ?>>II</option> 
       <option value="III"<?php if($d1_sname=="III"){echo ' selected="selected"';} ?>>III</option> 
      </select> 
      </td> 
      </tr> 
      <tr> 
      <td>Street Address</td> 
      <td><input style="background-color: #FEFEB6;" name="d1_add" size="20" type="text" <?php if(!empty($d1_add)){echo 'value="'.$d1_add.'" ';} ?>/></td> 
      <td>City</td> 
      <td><input style="background-color: #FEFEB6;" name="d1_city" size="20" type="text" <?php if(!empty($d1_city)){echo 'value="'.$d1_city.'" ';} ?>/></td> 
      </tr> 
      <tr> 
      <td>State</td> 
      <td> 
      <select style="background-color: #FEFEB6;" name="d1_state"> 
       <option value="STATE"<?php if($d1_state=="STATE"){echo ' selected="selected"';} ?>>-- Select --</option> 
       <option value="AL"<?php if($d1_state=="AL"){echo ' selected="selected"';} ?>>Alabama</option> 
       <option value="AZ"<?php if($d1_state=="AZ"){echo ' selected="selected"';} ?>>Arizona</option> 
       <option value="AR"<?php if($d1_state=="AR"){echo ' selected="selected"';} ?>>Arkansas</option> 
       <option value="CO"<?php if($d1_state=="CO"){echo ' selected="selected"';} ?>>Colorado</option> 
       <option value="DE"<?php if($d1_state=="DE"){echo ' selected="selected"';} ?>>Delaware</option> 
       <option value="FL"<?php if($d1_state=="FL"){echo ' selected="selected"';} ?>>Florida</option> 
       <option value="GA"<?php if($d1_state=="GA"){echo ' selected="selected"';} ?>>Georgia</option> 
       <option value="IL"<?php if($d1_state=="IL"){echo ' selected="selected"';} ?>>Illinois</option> 
       <option value="IN"<?php if($d1_state=="IN"){echo ' selected="selected"';} ?>>Indiana</option> 
       <option value="IA"<?php if($d1_state=="IA"){echo ' selected="selected"';} ?>>Iowa</option> 
       <option value="KS"<?php if($d1_state=="KS"){echo ' selected="selected"';} ?>>Kansas</option> 
       <option value="KY"<?php if($d1_state=="KY"){echo ' selected="selected"';} ?>>Kentucky</option> 
       <option value="LA"<?php if($d1_state=="LA"){echo ' selected="selected"';} ?>>Louisiana</option> 
       <option value="ME"<?php if($d1_state=="ME"){echo ' selected="selected"';} ?>>Maine</option> 
       <option value="MI"<?php if($d1_state=="MI"){echo ' selected="selected"';} ?>>Michigan</option> 
       <option value="MO"<?php if($d1_state=="MO"){echo ' selected="selected"';} ?>>Missouri</option> 
       <option value="NE"<?php if($d1_state=="NE"){echo ' selected="selected"';} ?>>Nebraska</option> 
       <option value="NV"<?php if($d1_state=="NV"){echo ' selected="selected"';} ?>>Nevada</option> 
       <option value="NJ"<?php if($d1_state=="NJ"){echo ' selected="selected"';} ?>>New Jersey</option> 
       <option value="NY"<?php if($d1_state=="NY"){echo ' selected="selected"';} ?>>New York</option> 
       <option value="NC"<?php if($d1_state=="NC"){echo ' selected="selected"';} ?>>North Carolina</option> 
       <option value="ND"<?php if($d1_state=="ND"){echo ' selected="selected"';} ?>>North Dakota</option> 
       <option value="OH"<?php if($d1_state=="OH"){echo ' selected="selected"';} ?>>Ohio</option> 
       <option value="OK"<?php if($d1_state=="OK"){echo ' selected="selected"';} ?>>Oklahoma</option> 
       <option value="OR"<?php if($d1_state=="OR"){echo ' selected="selected"';} ?>>Oregon</option> 
       <option value="PA"<?php if($d1_state=="PA"){echo ' selected="selected"';} ?>>Pennsylvania</option> 
       <option value="RI"<?php if($d1_state=="RI"){echo ' selected="selected"';} ?>>Rhode Island</option> 
       <option value="SC"<?php if($d1_state=="SC"){echo ' selected="selected"';} ?>>South Carolina</option> 
       <option value="SD"<?php if($d1_state=="SD"){echo ' selected="selected"';} ?>>South Dakota</option> 
       <option value="TN"<?php if($d1_state=="TN"){echo ' selected="selected"';} ?>>Tennessee</option> 
       <option value="TX"<?php if($d1_state=="TX"){echo ' selected="selected"';} ?>>Texas</option> 
       <option value="UT"<?php if($d1_state=="UT"){echo ' selected="selected"';} ?>>Utah</option> 
       <option value="VA"<?php if($d1_state=="VA"){echo ' selected="selected"';} ?>>Virginia</option> 
       <option value="WV"<?php if($d1_state=="WV"){echo ' selected="selected"';} ?>>West Virginia</option> 
       <option value="WI"<?php if($d1_state=="WI"){echo ' selected="selected"';} ?>>Wisconsin</option> 
      </select> 
      </td> 
      <td>Zip</td> 
      <td><input style="background-color: #FEFEB6;" name="d1_zip" size="5" type="text" <?php if(!empty($d1_zip)){echo 'value="'.$d1_zip.'" ';} ?>/></td> 
      </tr> 
      <tr> 
      <td>County</td> 
      <td><input style="background-color: #FEFEB6;" name="d1_county" size="20" type="text" <?php if(!empty($d1_county)){echo 'value="'.$d1_county.'" ';} ?>/></td> 
      <td></td> 
      <td></td> 
      </tr> 
      <tr> 
      <td>E-Mail Address</td> 
      <td><input style="background-color: #FEFEB6;" name="d1_email" size="20" type="text" <?php if(!empty($d1_email)){echo 'value="'.$d1_email.'" ';} ?>/></td> 
      <td>Home Phone</td> 
      <td> 
      (<input style="background-color: #FEFEB6;" name="d1_phone1" size="3" type="text" maxlength="3" <?php if(!empty($d1_phone1)){echo 'value="'.$d1_phone1.'" ';} ?>/>) 
      <input style="background-color: #FEFEB6;" name="d1_phone2" size="3" type="text" maxlength="3" <?php if(!empty($d1_phone2)){echo 'value="'.$d1_phone2.'" ';} ?>/>- 
      <input style="background-color: #FEFEB6;" name="d1_phone3" size="4" type="text" maxlength="4" <?php if(!empty($d1_phone3)){echo 'value="'.$d1_phone3.'" ';} ?>/> 
      </td> 
      </tr> 
      <tr> 
      <td>Preferred Contact</td> 
      <td colspan="3"> 
       <input name="d1_contact" value="1" type="radio" <?php if($d1_contact=="1"){echo 'checked="checked" ';}?>>E-Mail 
       <input name="d1_contact" value="2" type="radio" <?php if($d1_contact=="2"){echo 'checked="checked" ';}?>>Phone 
       <input name="d1_contact" value="3" type="radio" <?php if($d1_contact=="3"){echo 'checked="checked" ';}?>>USPS Mail 
      </td> 
      </tr> 
     </table> 
     <hr /> 

     <h3>Call (866) 333-1829 for Fast Personal Service!</h3> 
     <hr /> 

     <table border="0"> 
     <tr> 
      <td><p>We appreciate you taking the time to submit your quote information. The MRA is an agency with several different A rated companies. We will shop the market for you to find the best rate. All the questions asked pertain to the many discounts our insurance companies offer. Should you have any questions about getting an insurance quote or would feel more comfortable talking to an agent please contact our office at <b>(866) 333-1829</b> 9:00am - 6:00pm EST Monday thru Friday.</p></td> 
      <td><?php echo $siteSeal; ?></td> 
     </tr> 
     </table>   

     <hr /> 
     <p>We currently insure in the following states: Alabama, Arizona, Arkansas, Colorado, Delaware, Florida, Georgia, Illinois, Indiana, Iowa, Kansas, Kentucky, Louisiana, Maine, Michigan, Missouri, Nebraska, Nevada, New Jersey, New York, North Carolina, North Dakota, Ohio, Oklahoma, Oregon, Pennsylvania, Rhode Island, South Carolina, South Dakota, Tennessee, Texas, Utah, Virginia, West Virginia and Wisconsin.</p> 
     <hr /> 
     <p>If you have more than 2 drivers and/or 2 vehicles and would like to get a quote with, please call our Office Toll-Free at <b>(866) 333-1829</b>.</p> 
     <hr /> 
    <center><?php echo recaptcha_get_html($recaptcha_publickey, null, true); ?></center> 
     <hr /> 
     <p class="center"><input name="submit" value="Continue" src="<?php echo $linkedURL; ?>/images/continue-motorcycle-quote.jpg" type="submit"></p> 
     </form> 
     </div><!--close quotebox--> 
     </div><!--close quote--> 

<?php include 'site/inc/www2-footer.php'; ?> 
</body> 
</html> 
+1

是$ d1_add實際初始化了嗎?我的意思是,你是否設定了一個價值?因爲如果你這樣做不是在你發佈的代碼 – 2013-04-09 13:00:23

+0

請發佈**所有**你的代碼。 – chriz 2013-04-09 13:01:22

+0

你可以通過數組來做到這一點,並計數數組 – 2013-04-09 13:01:26

回答

1

變化:

 } else { 
       $d1_fname   = $_POST['d1_fname']; 
       $d1_lname   = $_POST['d1_lname']; 
       $d1_mname   = $_POST['d1_mname']; 
       $d1_sname   = $_POST['d1_sname']; 
       $d1_city   = $_POST['d1_city']; 
       $d1_state   = $_POST['d1_state']; 
       $d1_zip    = $_POST['d1_zip']; 
       $d1_county   = $_POST['d1_county']; 
       $d1_phone1   = $_POST['d1_phone1']; 
       $d1_phone2   = $_POST['d1_phone2']; 
       $d1_phone3   = $_POST['d1_phone3']; 
       $d1_email   = $_POST['d1_email']; 
       $d1_contact   = $_POST['d1_contact']; 
     } 

 } else { 
       $d1_add    = $_POST['d1_add']; 
       $d1_fname   = $_POST['d1_fname']; 
       $d1_lname   = $_POST['d1_lname']; 
       $d1_mname   = $_POST['d1_mname']; 
       $d1_sname   = $_POST['d1_sname']; 
       $d1_city   = $_POST['d1_city']; 
       $d1_state   = $_POST['d1_state']; 
       $d1_zip    = $_POST['d1_zip']; 
       $d1_county   = $_POST['d1_county']; 
       $d1_phone1   = $_POST['d1_phone1']; 
       $d1_phone2   = $_POST['d1_phone2']; 
       $d1_phone3   = $_POST['d1_phone3']; 
       $d1_email   = $_POST['d1_email']; 
       $d1_contact   = $_POST['d1_contact']; 
     } 

在你的最後else聲明。問題是這個值沒有被賦予一個值,所以它會在你每次POST時返回空的

+0

非常感謝!我不能代表任何人,但任何人都可以請。一些如此簡單,但我仍然錯過了它。再次謝謝你! – Sriahciboon 2013-04-09 13:17:06

+0

@Sriahciboon沒問題 - 但請通過選中答案左側的箭頭標記答案,以便將問題標記爲已關閉。再次感謝。 – 2013-04-09 13:41:51

+0

啊,我知道這是$ d1_add的問題! – 2013-04-09 13:59:02

0

你可能錯過了下面一行在你的最後else

$d1_add    = $_POST['d1_add'];