Jump to content

FORM data help


quickfire84

Recommended Posts

Ok, I have several forms, but before they can fil out any of them they gotta fill out this first one, i have a database set up with tables a table for each form.  I wanna know how i can make the forms post into the tables i need them too, like this form i need it to post in my customers DB in the quotes TABLE how do i do this?  I have html form the post and send info to this which then send me a email and them a email i wanna do that but also post in DB into the table..?

<?php
// Pick up the form data and assign it to variables
$name = $_POST['name'];
$email = $_POST['email'];
$phone = $_POST['phone'];
$companyname = $_POST['companyname'];
$idealcustomer = $_POST['idealcustomer'];
$productservices = $_POST['productservices'];
$maincompet = $_POST['maincompet'];
$differcompet = $_POST['differcompet'];
$needdone = $_POST['needdone'];
$lookingfor = $_POST['lookingfor'];
$doneby = $_POST['doneby'];
$anythingelse = $_POST['anythingelse'];




// Validation 
if($name == '')  
{ 
die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid Name</font></p>"); 
} 


if (! ereg('[A-Za-z0-9_-]+\@[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+', $email)) 
{ 
die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid email</font></p>"); 
} 

if($companyname == '')  
{ 
die("<p align='center'><font face='Arial' size='3' color='#FF0000'>Please enter a valid Company name</font></p>"); 
} 


// Build the email (replace the address in the $to section with your own)
$to = '[email protected]';
$subject = "Quote Submittion";
$message = "Name: $name, \n Email: $email, \n Phone Number: $phone, \n Comapny Name: $companyname, \n Ideal Customer: $idealcustomer, \n Product or Services: $productservices, \n Main Competition: $maincompet, \n How You Differ From Competition: $differcompet, \n Services Needed: $needdone, \n Looking For: $lookingfor, \n Need Done By: $doneby, \n Anything Else: $anythingelse";
$headers = "From: $email";

// Send the mail using PHPs mail() function
mail($to, $subject, $message, $headers);

//Sending auto respond Email to visitor 
$header = "From: [email protected]" 
. "Reply-To: [email protected]"; 
$subject = "Confirmation of quote enquiry to moppie.illusions"; 
$to = "$email"; 
$message = "Thank You $n for choosing moppie.illusions, Your quote enquiry will be processed immediately \n \n \n Sincerely, \n Chris Cardarello \n Webmaster \n moppie.illusions "; 

// Send the mail using PHPs mail() function
mail($to, $subject, $message, $headers);

// Redirect
header("Location: success.html");




?>

Link to comment
https://forums.phpfreaks.com/topic/157589-form-data-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.