Page 1 of 1

My contact form works but it does not send information...

Posted: Tue Sep 30, 2008 10:52 pm
by digital.patience
Hello I need someone to review my code I am just learning PHP via trial and error. I copied and pasted this code from a flash file I had and "guessed" what to do next. The form works great...I receive an e-mail and everything... but the information that is submitted is does not show up. This is the php

Code: Select all

<?php
$sendTo = "123456@doximagry.com";
$subject = "(Website) - Contact Form";
$project = $_GET['project'];
$email = $_GET['email'];
$about = $_GET['about'];
$budget = $_GET['budget'];
$deadline = $_GET['deadline'];
$referral = $_GET['referral'];
    //send mail
    $headers  = "From: $email\r\n";
    //$headers .= 'MIME-Version: 1.0' . "\r\n";
    //$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    $msg = "The following information has been submited via website:\n\nAbout&#058;".$about."\n\nE-mail:".$email."\n\nProject:".$project."\n\nBudget:".$budget."\n\nDeadline:".$deadline."\n\nReferral:".$referral."";
    mail($sendTo, $subject, $msg, $headers);
    echo header ("Location: http://www.doximagry.com/received.html");
?>
and this is the contact form

Code: Select all

<form id="form" action="contact.php" method="post">
 
                <fieldset>
            
                    <label>What is your name // what do you do?</label>
 
                    <textarea name="about" rows="4" cols="50"></textarea>
 
                    <label>Please tell me about your project.</label>
                    <textarea name="project" rows="4" cols="50"></textarea>
                </fieldset>
 
                <fieldset>
        
                    <label>What is your budget?</label>
                    <input name="budget" type="text" size="16">
 
                    <label>When is your deadline?</label>
                    <input name="deadline" type="text">
 
                    <label>What is your email address?</label>
                    <input name="email" type="text" size="32">
 
                    <label>How did you hear about me?</label>
                    <input name="referral" type="text" size="24">
 
                    <input type="submit" value="Send"><input type="reset"  value="Clear">
                </fieldset>
                
            </form>
and this is a screen shot of the end results:
Image

I just updated my website and I have already missed a contact

Re: My contact form works but it does not send information...

Posted: Wed Oct 01, 2008 1:46 am
by jaoudestudios
You are mixing post and get. Use one or the other.

Re: My contact form works but it does not send information...

Posted: Wed Oct 01, 2008 4:52 am
by vishal.angre
You need to use post variables instead of $_GET

like this,

$project = $_POST['project'];
$email = $_POST['email'];
$about = $_POST['about'];
$budget = $_POST['budget'];
$deadline = $_POST['deadline'];
$referral = $_POST['referral'];

Re: My contact form works but it does not send information...

Posted: Wed Oct 01, 2008 11:15 am
by digital.patience
Many thanks guys :D the form is working perfectly!!