Jump to content

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 = 'webmaster@moppieillusions.com';
$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: webmaster@moppieillusions.com" 
. "Reply-To: webmaster@moppieillusions.com"; 
$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

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.