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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
digital.patience
Forum Newbie
Posts: 4
Joined: Tue Sep 30, 2008 10:38 pm

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

Post 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
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

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

Post by jaoudestudios »

You are mixing post and get. Use one or the other.
vishal.angre
Forum Newbie
Posts: 11
Joined: Wed Oct 01, 2008 4:32 am
Location: Mumbai, India

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

Post 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'];
digital.patience
Forum Newbie
Posts: 4
Joined: Tue Sep 30, 2008 10:38 pm

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

Post by digital.patience »

Many thanks guys :D the form is working perfectly!!
Post Reply