Jump to content

Recommended Posts

I have been working on this form that seems to manage validating the right way, but I need it to submit afterwards and can't figure out how to do that how I want. I'm still new with PHP and could use some help.

I'm trying to make the form submit similar to this one, with no need for javascript.

http://allstatescartransport.com/car-transport.html

 

Here is my validation script so far. It's kind of bulk but I'm new at this, and any help is appreciated


<?php

if($_POST)
{
$first_name = $_POST['first_name']; 
$last_name = $_POST['last_name'];  
$phone = $_POST['phone'];
$email = $_POST['email'];
$year1 = $_POST['year1'];
$make1 = $_POST['make1']; 
$model1 = $_POST['model1'];  
$vehicle_type_id1 = $_POST['vehicle_type_id1']; 
$pickup_city = $_POST['pickup_city']; 
$pickup_state_code = $_POST['pickup_state_code'];
$dropoff_city = $_POST['dropoff_city']; 
$dropoff_state_code = $_POST['dropoff_state_code'];  
$vehicle_runs = $_POST['vehicle_runs'];
$ship_via_id = $_POST['ship_via_id'];
$estimated_ship_date = $_POST['estimated_ship_date'];


// First Name
if (preg_match ("/ ^ [A-Za-z -] {3.20} $ /", $ first_name))
{
 $valid_first_name=$first_name;
}
else
{  
   $error_first_name='Enter valid First Name.';  
}
// Last Name
if (preg_match ("/ ^ [A-Za-z -] {3.20} $ /", $ last_name))
{
 $valid_last_name=$last_name;
}
else
{  
   $error_last_name='Enter valid Last Name.';  
}
// Phone
if (preg_match ("/ ^ [0-9 -] {7.20} $ /", $ phone))
{
 $valid_phone=$phone;
}
else
{  
   $error_phone='Enter valid Phone Number.';  
}
// Email 
if (preg_match ("/ ^ [a-zA-Z0-9._-] + @ [a-zA-Z0-9._-] + \. ([a-zA-Z] {2,4}) $ / ", $ email))
{
 $valid_email=$email; 
}
else
{  
   $error_email='Enter valid Email.';  
}
// Year
if (preg_match("/^[0-9 -]{2,20}$/",$year1))
{
 $valid_year1=$year1;
}
else
{  $error_year1='Enter valid Vehicle Year.';  }

// Make

if (preg_match ("/ ^ [A-Za-z0-9 -] {2.25} $ /", $ make1))
{
$valid_make1=$make1;
}
else
{  
   $error_make1='Enter valid Vehicle Make.';  
}
// Model

if (preg_match ("/ ^ [A-Za-z0-9 -] {2.25} $ /", $ model1))
{
$valid_model1=$model1;
}
else
{  
   $error_model1='Enter valid Vehicle Model.';  
}

// Vehicle Type
if ($vehicle_type_id1==00)
{
  $error_vehicle_type_id1='Select Vehicle Type'; 
}
else
{  
$valid_vehicle_type_id1=$vehicle_type_id1;

}
// Pickup City
if (preg_match ("/ ^ [A-Za-z0-9 -] {3.20} $ /", $ pickup_city))
{
 $valid_pickup_city=$pickup_city;
}
else
{  
   $error_pickup_city='Enter valid Pickup City.';  
}
// Pickup state
if ($pickup_state_code==00)
{
  $error_pickup_state_code='Select Pickup State.'; 
}
else
{  
$valid_pickup_state_code=$pickup_state_code;

}
// Dropoff City
if (preg_match ("/ ^ [A-Za-z0-9 -] {3.20} $ /", $ dropoff_city))
{
 $valid_dropoff_city=$dropoff_city;
}
else
{  
   $error_dropoff_city='Enter valid Dropoff City.';  
}
// Dropoff state
if ($dropoff_state_code==00)
{
  $error_dropoff_state_code='Select Dropoff State.'; 
}
else
{  
$valid_dropoff_state_code=$dropoff_state_code;

}
// Vehicle Runs
if ($vehicle_runs==00)
{
  $error_vehicle_runs='Does your vehicle run?'; 
}
else
{  
$valid_vehicle_runs=$vehicle_runs;

}
// Ship Via
if ($ship_via_id==00)
{
  $error_ship_via_id='Select how to ship.'; 
}
else
{  
$valid_ship_via_id=$ship_via_id;

}
// Estimated Shipping Date
if (preg_match("/^[0-9]{1,2}\/[0-9]{1,2}\/[0-9]{4}$/",$estimated_ship_date))
{
 $valid_estimated_ship_date=$estimated_ship_date;
}
else
{  
   $error_estimated_ship_date='Enter valid Shipping Date.';  
}

($ Valid_ship_via_id> 0) && (strlen ($ valid_estimated_ship_date)> 0))
{}
{
post to process.php


}


}
?>

Link to comment
https://forums.phpfreaks.com/topic/271649-php-form-validate-and-submit/
Share on other sites

Change if($_POST) { to if($_SERVER['REQUEST_METHOD'] === "POST") {

 

($ Valid_ship_via_id> 0) && (strlen ($ valid_estimated_ship_date)> 0))
{}
{
post to process.php


}

 

I have no idea what you are expecting to happen with these lines. It's not even valid.

Edited by SocialCloud

Change if($_POST) { to if($_SERVER['REQUEST_METHOD'] === "POST") {

 

($ Valid_ship_via_id> 0) && (strlen ($ valid_estimated_ship_date)> 0))
{}
{
post to process.php


}

 

I have no idea what you are expecting to happen with these lines. It's not even valid.

I know, that's where I believe the submission part should go, but I'm transitioning from straight html experience and learning php as I go

If you are trying to post to another page it won't work unless you use the variables in the url or use $_SESSION variables

 

The page you are trying to mimic uses a single file. I suggest submitting whatever you are trying to do on the same page or use a function.

Edited by SocialCloud

If you are trying to post to another page it won't work unless you use the variables in the url or use $_SESSION variables

 

The page you are trying to mimic uses a single file. I suggest submitting whatever you are trying to do on the same page or use a function.

The rest of the code is very long, but it's a pretty basic form. The javascript validation works, but for some reason people like keeping it disabled and that messes things up on the submission. IE9 also doesn't use html5 so that doesn't help on that front. It should validate against itself, and I was attempting to make it post the validated data through to the process.php file that also has analytics code in it...


<label class="desc" id="title1" for="Field1">
First Name </label>
<div>
<input name="first_name" type="text" required class="field text medium" id="first_name" pattern="[A-Za-z -]{3,20}" tabindex="1" value="<?php echo $valid_first_name; ?>" maxlength="255"><span class="err"> <?php echo $error_first_name; ?></span>
</div>

The form basically goes through like that except for dropdowns


<div>
<select id="vehicle_runs" name="vehicle_runs" class="field select medium" tabindex="13" style="float:left">
<option value="00">Runs?</option><option value="1">Yes</option><option value="2">No</option>
</select><span class="err"> <?php echo $error_vehicle_runs; ?></span>
</div>

Edited by ott
I know, that's where I believe the submission part should go, but I'm transitioning from straight html experience and learning php as I go

 

Is there a reason the validation part can't be added to your process.php script? The script, for example, could do something like

  1. validate form fields
  2. if the form fields are invalid
    • redirect to form (or display form again) for user to fix the information

[*]else

  • display confirmation

Is there a reason the validation part can't be added to your process.php script? The script, for example, could do something like

  1. validate form fields
  2. if the form fields are invalid
    • redirect to form (or display form again) for user to fix the information

[*]else

  • display confirmation

I would be perfectly happy with that actually. I just don't know how to do it! Here is my process.php script so you can see what all it currently does.


<?php

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.jtracker.com/lead_post.php");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($_POST));
$data = curl_exec($ch);
curl_close($ch);

mysql_connect("localhost", "user", "password") or die("Connection Failed");
mysql_select_db("database")or die("Connection Failed");
$referrer = $_POST['referrer'];
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$vehicle_type_id1 = $_POST['vehicle_type_id1'];
$pickup_city = $_POST['pickup_city'];
$pickup_state_code = $_POST['pickup_state_code'];
$dropoff_city = $_POST['dropoff_city'];
$dropoff_state_code = $_POST['dropoff_state_code'];
$vehicle_runs = $_POST['vehicle_runs'];
$ship_via_id = $_POST['ship_via_id'];
$estimated_ship_date = $_POST['estimated_ship_date'];
$query = "INSERT INTO Boat_Shipping(referrer,first_name,last_name,email,phone,vehicle_type_id1,pickup_city,pickup_state_code,dropoff_city,dropoff_state_code,vehicle_runs,ship_via_id,estimated_ship_date)VALUES('$referrer','$first_name','$last_name','$email','$phone','$vehicle_type_id1','$pickup_city','$pickup_state_code','$dropoff_city','$dropoff_state_code','$vehicle_runs','$ship_via_id','$estimated_ship_date')";
if(mysql_query($query)){
echo "Your information is being processed. Please wait.";}
else{
echo "Database Error";}




mysql_close();




?>
<script type="text/javascript"> if (!window.mstag) mstag = {loadTag : function(){},time : (new Date()).getTime()};</script> <script id="mstag_tops" type="text/javascript" src="//flex.atdmt.com/mstag/site/0c411bd8-b188-4565-af73-9203c155365a/mstag.js"></script> <script type="text/javascript"> mstag.loadTag("analytics", {dedup:"1",domainId:"1570529",type:"1",actionid:"104890"})</script> <noscript> <iframe src="//flex.atdmt.com/mstag/tag/0c411bd8-b188-4565-af73-9203c155365a/analytics.html?dedup=1&domainId=1570529&type=1&actionid=104890" frameborder="0" scrolling="no" width="1" height="1" style="visibility:hidden;display:none"> </iframe> </noscript>

<meta http-equiv="REFRESH" content="1;url=/thankyou.php">
<center><h1>Please <a href="/thankyou.php">Click Here</a> if your Thank You page does not load.</h1></center>

Edited by ott

Change if($_POST) { to if($_SERVER['REQUEST_METHOD'] === "POST") {

 

($ Valid_ship_via_id> 0) && (strlen ($ valid_estimated_ship_date)> 0))
{}
{
post to process.php


}

 

I have no idea what you are expecting to happen with these lines. It's not even valid.

 

What you should really do is whatever the name for your submit button is in the html i.e.


<input type="submit" name="formSubmit"/>

 

that's what your if() statement should start out with....

if($_POST['formSubmit']){
// Validation Stuff
}

Edited by mdahlke

Server Request Method is better as some well known browsers scramble the submit button, thus rendering it useless to validate that way.

you mean just use this as the top line instead?

$_SERVER['REQUEST_METHOD'] === 'POST'

I'm limited in php right now, but that looks like it checks to see if the submit button has been pressed and then posts the info

Edited by ott

What if I make the validation part a seperate file, would I need to put that line at the top of to regular form and set action to post to that file?

like

form.php

<?php $SERVER['REQUEST_METHOD'] === 'POST'; ?>
<form method="post' action="process.php">
<input type="text" id="first_name" name="first_name" />
otherfields
.
.
.
.
.
.
<input type="submit">
</form>

 

process.php

 


<?php

if (count($_POST) <= 0)
{
   exit();
}

$aFilters = array(
   'first_name' => array(
       'filter' => FILTER_VALIDATE_REGEXP,
       'options' => array('regexp' => '/^[a-z- ]{3,20}$/i'),
   ),
   'last_name' => array(
       'filter' => FILTER_VALIDATE_REGEXP,
       'options' => array('regexp' => '/^[a-z- ]{3,20}$/i'),
   ),
   'phone' => array(
       'filter' => FILTER_VALIDATE_REGEXP,
       'options' => array('regexp' => '/^[0-9-]{7,20}$/i'),
   ),
   'email' => FILTER_VALIDATE_EMAIL,
   'year1' => array(
       'filter' => FILTER_VALIDATE_INT,
       'options' => array('min_range' => 1900, 'max_range' => 2100),
   ),
   'make1' => array(
       'filter' => FILTER_VALIDATE_REGEXP,
       'options' => array('regexp' => '/^[a-z0-9 -]{2,25}$/i'),
   ),
   'model1' => array(
       'filter' => FILTER_VALIDATE_REGEXP,
       'options' => array('regexp' => '/^[a-z0-9 -]{2,25}$/i'),
   ),
   'vehicle_type_id1' => array(
       'filter' => FILTER_VALIDATE_INT,
       'options' => array('min_range' => 1),
   ),
   'pickup_city' => array(
       'filter' => FILTER_VALIDATE_REGEXP,
       'options' => array('regexp' => '/^[a-z0-9 -]{3,20}$/i'),
   ),
   'pickup_state_code' => array(
       'filter' => FILTER_VALIDATE_REGEXP,
       'options' => array('regexp' => '/^[a-zA-Z- ]{2}$/i'),
   ),
   'dropoff_city' => array(
       'filter' => FILTER_VALIDATE_REGEXP,
       'options' => array('regexp' => '/^[a-z0-9 -]{3,20}$/i'),
   ),
   'dropoff_state_code' => array(
       'filter' => FILTER_VALIDATE_REGEXP,
       'options' => array('regexp' => '/^[a-zA-Z- ]{2}$/i'),
   ),
   'vehicle_runs' => array(
       'filter' => FILTER_VALIDATE_INT,
       'options' => array('min_range' => 1),
   ),
   'ship_via_id' => array(
       'filter' => FILTER_VALIDATE_INT,
       'options' => array('min_range' => 1),
   ),
   'estimated_ship_date' => array(
       'filter' => FILTER_CALLBACK,
       'options' => 'strtotime',
   )
);


$aFailureNotices = array (
'first_name' => 'Invalid First Name',
'last_name' => 'Invalid Last Name',
'phone' => 'Invalid Phone Number',
'email' => 'Invalid Email Address',
'year1' => 'Invalid Year',
'make1' => 'Invalid Make',
'model1' => 'Invalid Model',
'vehicle_type_id1' => 'Invalid Vehicle Type ID',
'pickup_city' => 'Invalid Pickup City',
'pickup_state_code' => 'Invalid Pickup State Code',
'dropoff_city' => 'Invalid Dropoff City',
'dropoff_state_code' => 'Invalid Dropoff State Code',
'vehicle_runs' => 'Invalid Vehicle Runs option',
'ship_via_id' => 'Invalid Ship Via ID',
'estimated_ship_date' => 'Invalid Estimate Ship Date',
);


// Do the work now.
// Filter the input array
$filtered = filter_input_array(INPUT_POST, $aFilters);

function isEmpty($s)
{
   return empty($s);
}

// Pick out the empty ones (null is actually not provided, false is failed)
$aBadEntries = array_filter($filtered, 'isEmpty');

// Get a collection of error messages
$aErrorMessages = array_intersect_key($aFailureNotices, $aBadEntries);

if (!empty($aErrorMessages))
{
   print('The following errors occurred: ');
   foreach ($aErrorMessages AS $error)
   {
       print PHP_EOL . $error;
       echo '<br>';
   }

echo '<br><center><table width="75%"><tr><td valign="top"><form action="" method="post" name="quoteForm">
<input type="hidden" name="broker_id" value="33d1918e06fd9a56a257ab44154e54e2" />
<input type="hidden" name="referrer" value="BPPC" />
<input type="hidden" name="post_back" value="http://www.shipyourcarnow.com/thankyou.php" />
<input type="hidden" name="company_name" value="SYCNB" />
<div class="column-1 left">
<h4>Contact Information:</h4>

<div class="fieldContainer">

<p><span class="redStar">*</span> First Name:
<input name="first_name" type="text" required="required" id="first_name" pattern="[A-Za-z -]{3,20}" value="" />
</p>
</div>

<div class="fieldContainer">
<p><span class="redStar">*</span> Last Name:
<input name="last_name" type="text" required="required" id="last_name" pattern="[A-Za-z -]{3,20}" value="" />

</p>
</div>

<div class="fieldContainer">
<p><span class="redStar">*</span> Phone:
<input name="phone" type="text" required="required" id="phone" pattern="[0-9 -]{7,20}" value="" />

</p>
</div>
<div class="fieldContainer">
<p><span class="redStar">*</span> Email:
<input name="email" type="text" required="required" id="email" pattern="[a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.([a-zA-Z]{2,4})" value="" />
</p>
</div>
<br />
<h4>Vehicle Information:</h4>
<div class="fieldContainer">
<p><span class="redStar">*</span> Year:
<input name="year1" type="text" required="required" id="year1" pattern="[0-9 -]{2,20}" value="" />

</p>
</div>
<div class="fieldContainer">
<p><span class="redStar">*</span> Make:
<input name="make1" type="text" required="required" id="make1" pattern="[A-Za-z0-9 -]{2,25}" value="" />

</p>
</div>
<div class="fieldContainer">
<p><span class="redStar">*</span> Model:
<input name="model1" type="text" required="required" id="model1" pattern="[A-Za-z0-9 -]{2,25}" value="" />

</p>
</div>
<div class="fieldContainer">
<p><span class="redStar">*</span> Vehicle Type:
<select name="vehicle_type_id1" id="vehicle_type_id1" >
<option label="Select one" value="00">Select one</option>
<option label="Coupe" value="21">Coupe</option>
<option label="Sedan Small" value="1">Sedan Small</option>
<option label="Sedan Midsize" value="13">Sedan Midsize</option>
<option label="Sedan Large" value="2">Sedan Large</option>
<option label="Convertible" value="14">Convertible</option>
<option label="Pickup Small" value="3">Pickup Small</option>
<option label="Pickup Crew Cab" value="5">Pickup Crew Cab</option>
<option label="Pickup Full-size" value="15">Pickup Full-size</option>
<option label="Pickup Extd. Cab" value="4">Pickup Extd. Cab</option>
<option label="RV" value="22">RV</option>
<option label="Dually" value="20">Dually</option>
<option label="SUV Small" value="6">SUV Small</option>
<option label="SUV Mid-size" value="7">SUV Mid-size</option>
<option label="SUV Large" value="8">SUV Large</option>
<option label="Travel Trailer" value="23">Travel Trailer</option>
<option label="Van Mini" value="9">Van Mini</option>
<option label="Van Full-size" value="10">Van Full-size</option>
<option label="Van Extd. Length" value="16">Van Extd. Length</option>
<option label="Van Pop-Top" value="18">Van Pop-Top</option>
<option label="Motorcycle" value="19">Motorcycle</option>
<option label="Boat" value="12">Boat</option>
<option label="Other" value="11">Other</option>
</select>
</p>
</div>
<div class="fieldContainer">
<p>Vehicle Type, Other:
<input type="text" name="vehicle_type_other1" id="vehicle_type_other1" value="" style="width:100px;" />
</p>
</div>
</div></td><td valign="top">
<div class="column left">
<h4>Pickup Information:</h4>
<div class="fieldContainer">
<p><span class="redStar">*</span> City:
<input name="pickup_city" type="text" required="required" id="pickup_city" pattern="[A-Za-z0-9 -]{3,20}" value="" />
</p>
</div>
<div class="fieldContainer">
<p><span class="redStar">*</span> State:
<select name="pickup_state_code" id="pickup_state_code">
<option label="Select State" value="00">Select State</option>
<option label="Alabama" value="AL">Alabama</option>
<option label="Alaska" value="AK">Alaska</option>
<option label="Arizona" value="AZ">Arizona</option>
<option label="Arkansas" value="AR">Arkansas</option>
<option label="California" value="CA">California</option>
<option label="Colorado" value="CO">Colorado</option>
<option label="Connecticut" value="CT">Connecticut</option>
<option label="Delaware" value="DE">Delaware</option>
<option label="Dist. of Columbia" value="DC">Dist. of Columbia</option>
<option label="Florida" value="FL">Florida</option>
<option label="Georgia" value="GA">Georgia</option>
<option label="Guam" value="GU">Guam</option>
<option label="Hawaii" value="HI">Hawaii</option>
<option label="Idaho" value="ID">Idaho</option>
<option label="Illinois" value="IL">Illinois</option>
<option label="Indiana" value="IN">Indiana</option>
<option label="Iowa" value="IA">Iowa</option>
<option label="Kansas" value="KS">Kansas</option>
<option label="Kentucky" value="KY">Kentucky</option>
<option label="Louisiana" value="LA">Louisiana</option>
<option label="Maine" value="ME">Maine</option>
<option label="Maryland" value="MD">Maryland</option>
<option label="Massachusetts" value="MA">Massachusetts</option>
<option label="Michigan" value="MI">Michigan</option>
<option label="Minnesota" value="MN">Minnesota</option>
<option label="Mississippi" value="MS">Mississippi</option>
<option label="Missouri" value="MO">Missouri</option>
<option label="Montana" value="MT">Montana</option>
<option label="Nebraska" value="NE">Nebraska</option>
<option label="Nevada" value="NV">Nevada</option>
<option label="New Hampshire" value="NH">New Hampshire</option>
<option label="New Jersey" value="NJ">New Jersey</option>
<option label="New Mexico" value="NM">New Mexico</option>
<option label="New York" value="NY">New York</option>
<option label="North Carolina" value="NC">North Carolina</option>
<option label="North Dakota" value="ND">North Dakota</option>
<option label="Ohio" value="OH">Ohio</option>
<option label="Oklahoma" value="OK">Oklahoma</option>
<option label="Oregon" value="OR">Oregon</option>
<option label="Pennsylvania" value="PA">Pennsylvania</option>
<option label="Puerto Rico" value="PR">Puerto Rico</option>
<option label="Rhode Island" value="RI">Rhode Island</option>
<option label="South Carolina" value="SC">South Carolina</option>
<option label="South Dakota" value="SD">South Dakota</option>
<option label="Tennessee" value="TN">Tennessee</option>
<option label="Texas" value="TX">Texas</option>
<option label="Utah" value="UT">Utah</option>
<option label="Vermont" value="VT">Vermont</option>
<option label="Virgin Islands" value="VI">Virgin Islands</option>
<option label="Virginia" value="VA">Virginia</option>
<option label="Washington" value="WA">Washington</option>
<option label="West Virginia" value="WV">West Virginia</option>
<option label="Wisconsin" value="WI">Wisconsin</option>
<option label="Wyoming" value="WY">Wyoming</option>
<option label="Canada-Province" value="CP">Canada-Province</option>
<option label="Alberta" value="AB">Alberta</option>
<option label="British Columbia" value="BC">British Columbia</option>
<option label="Manitoba" value="MB">Manitoba</option>
<option label="New Brunswick" value="NB">New Brunswick</option>
<option label="Newfoundland" value="NL">Newfoundland</option>
<option label="NW Territories" value="NT">NW Territories</option>
<option label="Nova Scotia" value="NS">Nova Scotia</option>
<option label="Nunavut" value="NU">Nunavut</option>
<option label="Ontario" value="ON">Ontario</option>
<option label="Prince Edward Isl." value="PE">Prince Edward Isl.</option>
<option label="Quebec" value="QC">Quebec</option>
<option label="Saskatchewan" value="SK">Saskatchewan</option>
<option label="Yukon" value="YT">Yukon</option>
<option label="Other Countries" value="OC">Other Countries</option>
</select>
</p>
</div>
<div class="fieldContainer">
<p>Zip:
<input type="text" name="pickup_zip" id="pickup_zip" value="" />
</p>
</div>

<br />
<h4>Dropoff Information:</h4>
<div class="fieldContainer">
<p><span class="redStar">*</span> City:
<input name="dropoff_city" type="text" required="required" id="dropoff_city" pattern="[A-Za-z0-9 -]{3,20}" value="" />
</p>
</div>
<div class="fieldContainer">
<p><span class="redStar">*</span> State:
<select name="dropoff_state_code" id="dropoff_state_code">
<option label="Select State" value="00">Select State</option>
<option label="Alabama" value="AL">Alabama</option>
<option label="Alaska" value="AK">Alaska</option>
<option label="Arizona" value="AZ">Arizona</option>
<option label="Arkansas" value="AR">Arkansas</option>
<option label="California" value="CA">California</option>
<option label="Colorado" value="CO">Colorado</option>
<option label="Connecticut" value="CT">Connecticut</option>
<option label="Delaware" value="DE">Delaware</option>
<option label="Dist. of Columbia" value="DC">Dist. of Columbia</option>
<option label="Florida" value="FL">Florida</option>
<option label="Georgia" value="GA">Georgia</option>
<option label="Guam" value="GU">Guam</option>
<option label="Hawaii" value="HI">Hawaii</option>
<option label="Idaho" value="ID">Idaho</option>
<option label="Illinois" value="IL">Illinois</option>
<option label="Indiana" value="IN">Indiana</option>
<option label="Iowa" value="IA">Iowa</option>
<option label="Kansas" value="KS">Kansas</option>
<option label="Kentucky" value="KY">Kentucky</option>
<option label="Louisiana" value="LA">Louisiana</option>
<option label="Maine" value="ME">Maine</option>
<option label="Maryland" value="MD">Maryland</option>
<option label="Massachusetts" value="MA">Massachusetts</option>
<option label="Michigan" value="MI">Michigan</option>
<option label="Minnesota" value="MN">Minnesota</option>
<option label="Mississippi" value="MS">Mississippi</option>
<option label="Missouri" value="MO">Missouri</option>
<option label="Montana" value="MT">Montana</option>
<option label="Nebraska" value="NE">Nebraska</option>
<option label="Nevada" value="NV">Nevada</option>
<option label="New Hampshire" value="NH">New Hampshire</option>
<option label="New Jersey" value="NJ">New Jersey</option>
<option label="New Mexico" value="NM">New Mexico</option>
<option label="New York" value="NY">New York</option>
<option label="North Carolina" value="NC">North Carolina</option>
<option label="North Dakota" value="ND">North Dakota</option>
<option label="Ohio" value="OH">Ohio</option>
<option label="Oklahoma" value="OK">Oklahoma</option>
<option label="Oregon" value="OR">Oregon</option>
<option label="Pennsylvania" value="PA">Pennsylvania</option>
<option label="Puerto Rico" value="PR">Puerto Rico</option>
<option label="Rhode Island" value="RI">Rhode Island</option>
<option label="South Carolina" value="SC">South Carolina</option>
<option label="South Dakota" value="SD">South Dakota</option>
<option label="Tennessee" value="TN">Tennessee</option>
<option label="Texas" value="TX">Texas</option>
<option label="Utah" value="UT">Utah</option>
<option label="Vermont" value="VT">Vermont</option>
<option label="Virgin Islands" value="VI">Virgin Islands</option>
<option label="Virginia" value="VA">Virginia</option>
<option label="Washington" value="WA">Washington</option>
<option label="West Virginia" value="WV">West Virginia</option>
<option label="Wisconsin" value="WI">Wisconsin</option>
<option label="Wyoming" value="WY">Wyoming</option>
<option label="Canada-Province" value="CP">Canada-Province</option>
<option label="Alberta" value="AB">Alberta</option>
<option label="British Columbia" value="BC">British Columbia</option>
<option label="Manitoba" value="MB">Manitoba</option>
<option label="New Brunswick" value="NB">New Brunswick</option>
<option label="Newfoundland" value="NL">Newfoundland</option>
<option label="NW Territories" value="NT">NW Territories</option>
<option label="Nova Scotia" value="NS">Nova Scotia</option>
<option label="Nunavut" value="NU">Nunavut</option>
<option label="Ontario" value="ON">Ontario</option>
<option label="Prince Edward Isl." value="PE">Prince Edward Isl.</option>
<option label="Quebec" value="QC">Quebec</option>
<option label="Saskatchewan" value="SK">Saskatchewan</option>
<option label="Yukon" value="YT">Yukon</option>
<option label="Other Countries" value="OC">Other Countries</option>
</select>
</p>
</div>
<div class="fieldContainer">
<p>Zip:
<input type="text" name="dropoff_zip" id="dropoff_zip" value="" />
</p>
</div>

<div class="fieldContainer">
<p><span class="redStar">*</span> Ship Via:
<select name="ship_via_id" id="ship_via_id">
<option label="Select one" value="00">Select one</option>
<option label="Open" value="1">Open</option>
<option label="Enclosed" value="2">Enclosed</option>
<option label="Driveaway" value="3">Driveaway</option>
</select>
</p>
</div>
<div class="fieldContainer">
<p><span class="redStar">*</span> Est Ship Date:
<input name="estimated_ship_date" type="text" required="required" id="estimated_ship_date" style="width:80px;" pattern="[0-9]{1,2}/[0-9]{1,2}/[0-9]{4}" />
</p>
</div>
<div style="FONT-STYLE: normal; COLOR: #888888; FONT-WEIGHT: normal; font-size: 11px; margin-left: 105px; margin-top: -10px;">
MM/DD/YYYY
</div><br>
<input type="submit"></td></tr></table></center>';
}
else
{
   $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "[url="http://www.jtracker.com/lead_post.php"]http://www.jtracker..../lead_post.php"[/url]);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 100);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($_POST));
$data = curl_exec($ch);
curl_close($ch);


mysql_connect("localhost", "user", "password") or die("Connection Failed");
mysql_select_db("database")or die("Connection Failed");
$referrer = $_POST['referrer'];
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$vehicle_type_id1 = $_POST['vehicle_type_id1'];
$pickup_city = $_POST['pickup_city'];
$pickup_state_code = $_POST['pickup_state_code'];
$dropoff_city = $_POST['dropoff_city'];
$dropoff_state_code = $_POST['dropoff_state_code'];
$vehicle_runs = $_POST['vehicle_runs'];
$ship_via_id = $_POST['ship_via_id'];
$estimated_ship_date = $_POST['estimated_ship_date'];
$query = "INSERT INTO Boat_Shipping(referrer,first_name,last_name,email,phone,vehicle_type_id1,pickup_city,pickup_state_code,dropoff_city,dropoff_state_code,vehicle_runs,ship_via_id,estimated_ship_date)VALUES('$referrer','$first_name','$last_name','$email','$phone','$vehicle_type_id1','$pickup_city','$pickup_state_code','$dropoff_city','$dropoff_state_code','$vehicle_runs','$ship_via_id','$estimated_ship_date')";
if(mysql_query($query)){
echo "Your information is being processed. Please wait.";}
else{
echo "Database Error";}




mysql_close();

echo '<script type="text/javascript"> if (!window.mstag) mstag = {loadTag : function(){},time : (new Date()).getTime()};</script> <script id="mstag_tops" type="text/javascript" src="//flex.atdmt.com/mstag/site/xxxxxxxxxxxxxxxxxxxxxxxxxx/mstag.js"></script> <script type="text/javascript"> mstag.loadTag("analytics", {dedup:"1",domainId:"1570529",type:"1",actionid:"104890"})</script> <noscript> <iframe src="//flex.atdmt.com/mstag/tag/xxxxxxxxxxxxxxxxxxxxxxx/analytics.html?dedup=1&domainId=1570529&type=1&actionid=104890" frameborder="0" scrolling="no" width="1" height="1" style="visibility:hidden;display:none"> </iframe> </noscript>

<meta http-equiv="REFRESH" content="1;url=/thankyou.php">
<center><h1>Please <a href="/thankyou.php">Click Here</a> if your Thank You page does not load.</h1></center>';
}

?>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.