To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > PHP Help > General Help

General Help Forum for General Help questions pertaining to PHP

Reply
 
Thread Tools Rate Thread Display Modes
Old 07-06-2006, 04:05 PM   #1
j4mes_bond25
Name's Bond
 
Join Date: May 2006
Posts: 24
Question PHP Contact Form ???

After virtually, bending over backwards, I managed to FINALLY got the SMTP e-mail making it possible to actually receive the data entered by viewers in my Contact form.

Its code (in .txt) can be seen from:

http://members.lycos.co.uk/darsh25/A...ontact.php.txt

Actual page can be viewed on:

http://members.lycos.co.uk/darsh25/A...gn/contact.php

Sadly, however, I was only receiving the "message" itself & NOT the "title", "first_name", "last_name", "contact_no.", etc.

I realised that I didn't include other field WITHIN php's "mail" function & hence wasn't gettting this on my e-mail (after user submits the form).

I've now added "additional parameters" (if I'm right), so as to receive all the required fields. Firstly, I'm unsure if what I've added is right or wrong & secondly, I'm getting some "syntax" error.

So, the 1st version of this PHP "mail" code was:

PHP Code:
(mail("contact@allinclusivewebdesign.byethost13.com", $_POST['inquiry'], stripslashes($_POST['message']), "From: " . $_POST['email']))
The revised version i.e. the one where I've added "additional parameters", so as to receive ALL fields in my e-mail:

PHP Code:
(mail("contact@allinclusivewebdesign.byethost13.com",
    
$_POST['inquiry'],
    
stripslashes($_POST['message']),
(
"From: " . $_POST['email']),
(
"Inquiry: " . $_POST['inquiry']),
(
"Title: " . $_POST['title']),
(
"First Name: " . $_POST['first_name']),
(
"Last Name: " . $_POST['last_name']),
(
"E-mail: " . $_POST['email']),
(
"Phone: " . $_POST['phone']),
(
"Message: " . $_POST['message']),
(
"Reply: " . $_POST['reply']),
(
"Contact: " . $_POST['contact']))

I wonder, hence, if anyone around could possily check my "updated" code, which is:

http://members.lycos.co.uk/darsh25/A...pdated.php.txt

I simply wish to receive ALL the fields data on my e-mail.
j4mes_bond25 is offline   Reply With Quote
Old 07-06-2006, 05:49 PM   #2
fire_cracker
Senior Member
 
Join Date: Feb 2003
Location: Iowa, USA
Posts: 129
I think that you should asign your mail info to variables, it is hard to tell what is going on in that message. Then your mail command should look like this kinda:

mail($to,$subject,$message,$additional_headers);
fire_cracker is offline   Reply With Quote
Old 07-06-2006, 05:52 PM   #3
halojoy
phpMaster
 
Join Date: Jun 2005
Location: Europe
Posts: 2,374
hello

your new code might work
but best is if you test it in real world

take a look at how other people do it, in the php mail() function manual
http://php.net/manual/en/function.mail.php

it is to prefered make it like this
PHP Code:
<?php

$to      
= "contact@allinclusivewebdesign.byethost13.com";
$subject =  $_POST['inquiry'];
$message =  stripslashes($_POST['message']);

$headers = "From: " . $_POST['email']) . "\r\n" .
"Inquiry: " . $_POST['inquiry']) . "\r\n" .
"Title: " . $_POST['title']) . "\r\n" .
"First Name: " . $_POST['first_name']) ;
// and so on, etc. etc. etc.

mail( $to, $subject, $message, $headers );


// this is from php.net example:

$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';

$headers =
'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

?>
__________________
--
Wish you all a Good 2010
halojoy is offline   Reply With Quote
Old 07-07-2006, 08:43 AM   #4
j4mes_bond25
Name's Bond
 
Join Date: May 2006
Posts: 24
Exclamation

Quote:
Originally Posted by halojoy
hello

your new code might work
but best is if you test it in real world

take a look at how other people do it, in the php mail() function manual
http://php.net/manual/en/function.mail.php

it is to prefered make it like this
PHP Code:
<?php

$to      
= "contact@allinclusivewebdesign.byethost13.com";
$subject =  $_POST['inquiry'];
$message =  stripslashes($_POST['message']);

$headers = "From: " . $_POST['email']) . "\r\n" .
"Inquiry: " . $_POST['inquiry']) . "\r\n" .
"Title: " . $_POST['title']) . "\r\n" .
"First Name: " . $_POST['first_name']) ;
// and so on, etc. etc. etc.

mail( $to, $subject, $message, $headers );


// this is from php.net example:

$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';

$headers =
'From: webmaster@example.com' . "\r\n" .
'Reply-To: webmaster@example.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

?>
Thanks for your time & help.

That makes more sense in understanding if using $header.

A tiny error that I'm having at the moment, I'm afraid, which is beyond me, saying:

Parse error: syntax error, unexpected T_ELSE in C:\Program Files\xampp\htdocs\AllInclusiveWebDesign\contact.php on line 91

The entire "Contact.php" code so far is:

PHP Code:
<?php include("inc/head.inc");
include(
"inc/header.inc");
include(
"inc/banner.inc");
include(
"inc/left_right_content.inc");
?>

<div id="centerContent">

<?php

// If the form has been posted, analyse it:
if ($_POST) {
    foreach (
$_POST as $field => $value) {
        
$value = trim($value);
       }

// Creating Variables
    
$to="contact@allinclusivewebdesign.byethost13.com";
    
$inquiry=$_POST['inquiry'];
    
$title=$_POST['title'];
    
$first_name=$_POST['first_name'];
    
$last_name=$_POST['last_name'];
    
$email=$_POST['email'];
    
$phone=$_POST['phone'];
    
$message=stripslashes($_POST['message']);
    
$reply=$_POST['reply'];
    
$contact=$_POST['contact'];

    
$headers="From: " . $_POST['email'] . "\r\n" .
    
"Inquiry: " . $_POST['inquiry'] . "\r\n" .
    
"Title: " . $_POST['title'] . "\r\n" .  
    
"First Name: " . $_POST['first_name'] . "\r\n" .
    
"Last Name: " . $_POST['last_name'] . "\r\n" .
    
"E-mail: " . $_POST['email'] . "\r\n" .
    
"Phone: " . $_POST['phone'] . "\r\n" .
    
"Message: " . $_POST['message'] . "\r\n" .
    
"Reply: " . $_POST['reply'] . "\r\n" .
    
"Contact: " . $_POST['contact'];


// Create empty ERROR variables
    
$error = ""; // for fields left BLANK
    
$errorflag = ""; // for fields with INVALID data entered
    
// Check for field/fields that is/are left BLANK
    
if (($first_name == "") || ($last_name == "") || ($email == "") || ($phone == "") || ($message == "")) {
        
$error = "<span class='colorTextBlue'>Please fill in all fields!</span>";
    }
    else {
    
// Validate First Name (including ERRORS such as (1) field left BLANK (2) field with INVALID data entered
        
if (ctype_alpha($first_name) == FALSE)  {
            
$error = "<span class='colorTextBlue'>Please enter a valid First Name <span class='italic'>(Alphabets only)</span></span>";
            
$errorflag= "first_name";
            }
    
// Validate Last Name (including ERRORS such as (1) field left BLANK (2) field with INVALID data entered
        
else if (ctype_alpha($last_name) == FALSE) {
            
$error = "<span class='colorTextBlue'>Please enter a valid Last Name <span class='italic'>(Alphabets only)</span></span>";
            
$errorflag="last_name";
            }
    
// Validate E-mail (including ERRORS such as (1) field left BLANK (2) field with INVALID data entered
        
else if ((strpos($email, "@") == FALSE)||
            (
strpos($email, ".") == FALSE) ||
            (
strpos($email, " ") != FALSE)) {
                
$error = "<span class='colorTextBlue'>Please enter a valid E-mail</span>";
                
$errorflag="email";
            }
    
// Validate Contact No. (including ERRORS such as (1) field left BLANK (2) field with INVALID data entered
        
else if (is_numeric($phone) == FALSE) {
            
$error = "<span class='colorTextBlue'>Please enter a valid Contact No. <span class='italic'>(must contain numbers only)</span></span>";
            
$errorflag="phone";
            }
    }
    
// Confirmation Message seen AFTER filling the form and pressing "Submit" button (whether there's an error or not)
    
if ($error != "") {    echo "<br/>&nbsp;&nbsp;&nbsp;<b><span class='colorTextRed'>Error Occured: </b>" . $error."</span>" ; }
    
// If there's an error along with displaying the list of flagged error/errors

    // If there's NO error at all, along with displaying the filled fields
    
else if (mail($to, $subject, $message, $headers));
{
        echo
"<p><span class='colorTextBlue'>E-mail sent successfully</span></p>";
        echo
"<p>Thanks for your comment and time. We will be in touch with you shortly, if required. Following are the details you filled in.<br/><br/>";
        echo
"<b>Nature of Inquiry:</b> ". $inquiry . "<br/>";
        echo
"<b>Title:</b> ". $title . "<br/>";
        echo
"<b>First Name:</b> ". $first_name . "<br/>";
        echo
"<b>Last Name:</b> ". $last_name . "<br/>";
        echo
"<b>E-mail:</b> ". $email . "<br/>";
        echo
"<b>Contact No.:</b> ". $phone . "<br/>";
        echo
"<b>Message:</b> ". $message . "<br/>";
        echo
"<b>Reply:</b> ". $reply . "<br/>";
        echo
"<b>Contact Method:</b> ". $contact . "<br/></p>";
            }
    else if {
$error = "<span class='colorTextRed'>&nbsp;&nbsp;&nbsp;E-mail NOT sent</span>";
    }
}

// Displays the Empty variables
else {

    
$inquiry = "";
    
$title = "";
    
$first_name = "";
    
$last_name = "";
    
$email = "";
    
$phone = "";
    
$message = "";
    
$reply = "";
    
$contact = "";
    
$errorflag = "";
}
?>

<p class="first-letter">Please fill the following form in for any enquiries that you may have:</p>

<table id="contactTable">

<tr id="contactTable">
<td id="contactTable"><form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
Nature of Enquiry:</td>
<td id="contactTable"><select name="inquiry" class="contactForm">
<option <?php if ($inquiry == "General Inquiry") echo "Selected"; ?> value = "General Inquiry">General Inquiry</option>
<option <?php if ($inquiry == "Price Quotation") echo "Selected"; ?> value = "Price Quotation">Price Quotation</option>
<option <?php if ($inquiry == "Comments") echo "Selected"; ?> value = "Comments">Comments</option>
<option <?php if ($inquiry == "Other") echo "Selected"; ?> value = "Other">Other</option>
</select></td>
</tr>

<tr id="contactTable">
<td id="contactTable">Title:</td>
<td id="contactTable"><select name="title" class="contactForm"/>
<option <?php if ($title == "Mr") echo "Selected"; ?> value = "Mr">Mr</option>
<option <?php if ($title == "Miss") echo "Selected"; ?> value = "Miss">Miss</option>
<option <?php if ($title == "Ms") echo "Selected"; ?> value = "Ms">Ms</option>
<option <?php if ($title == "Mrs") echo "Selected"; ?> value = "Mrs">Mrs</option>
<option <?php if ($title == "Other") echo "Selected"; ?> value = "Other">Other</option>
</select></td>
</tr>

<tr id="contactTable">
<td id="contactTable"><?php if ($errorflag == "first_name") { echo "<span class='colorTextRed'>First Name:</span>"; }
                        else { echo
"First Name:"; } ?></td>
<td id="contactTable"><input type="text" size="30" maxlength="30" name="first_name" value="<?php echo $first_name; ?>" class="contactForm"/></td>
</tr>

<tr id="contactTable">
<td id="contactTable"><?php if ($errorflag == "last_name") { echo "<span class='colorTextRed'>Last Name:</span>"; }
                        else { echo
"Last name:"; } ?></td>
<td id="contactTable"><input type="text" size="30" maxlength="30" name="last_name" value="<?php echo $last_name; ?>" class="contactForm"/></td>
</tr>

<tr id="contactTable">
<td id="contactTable"><?php if ($errorflag == "email") { echo "<span class='colorTextRed'>E-mail:</span>"; }
                        else { echo
"E-mail:"; } ?></td>
<td id="contactTable"><input type="text" size="30" maxlength="30" name="email" value="<?php echo $email; ?>" class="contactForm"/></td>
</tr>

<tr id="contactTable">
<td id="contactTable"><?php if ($errorflag == "phone") { echo "<span class='colorTextRed'>Contact No.:</span>"; }
                        else { echo
"Contact No.:"; } ?></td>
<td id="contactTable"><input type="text" size="30" maxlength="20" name="phone" value="<?php echo $phone; ?>" class="contactForm"/></td>
</tr>

<tr id="contactTable">
<td id="contactTable">Message:</td>
<td id="contactTable"><textarea rows="10" cols="50" wrap="physical" name="message" class="contactForm"/><?php echo $message; ?>
</textarea></td>
</tr>

<tr id="contactTable">
<td id="contactTable">Reply Required:</td>
<td id="contactTable"><input type="radio" name="reply" value="Yes" checked="checked"/>Yes
<input type="radio" name="reply" value="No" <?php if ($reply=="No") echo "checked='checked'"; ?>/>No</td>
</tr>

<tr id="contactTable">
<td id="contactTable">How would you like to be contacted <span class="italic">(if required)</span>?<br/><br/></td>
<td id="contactTable"><input type="radio" name="contact" value="Email" checked="checked"/>E-mail
<input type="radio" name="contact" value="Telephone" <?php if ($contact=="Telephone") echo "checked='checked'"; ?>/>Telephone
</td>
</tr>

<tr id="contactTable">
<td id="contactTable"></td>
<td id="contactTable"><input type="reset" name="reset" value="Reset">
<input type="submit" name="submit" value="Submit"></td>
</form>
</tr>
</table>
</div>

<?php include("inc/footer.inc");?>
j4mes_bond25 is offline   Reply With Quote
Old 07-07-2006, 12:17 PM   #5
fire_cracker
Senior Member
 
Join Date: Feb 2003
Location: Iowa, USA
Posts: 129
It is actually pretty simple. This is the line causing the error:

PHP Code:
else if {
$error = "<span class='colorTextRed'>&nbsp;&nbsp;&nbsp;E-mail NOT sent</span>";
    }
It is only seeing the else, because you don't have any conditions on the if. You either have to change it to just an else statement, or add some conditions to the if. Judging by your code I am guessing you want this to just be an else statement.
fire_cracker is offline   Reply With Quote
Old 07-08-2006, 05:19 AM   #6
j4mes_bond25
Name's Bond
 
Join Date: May 2006
Posts: 24
Exclamation

Quote:
Originally Posted by fire_cracker
It is actually pretty simple. This is the line causing the error:

PHP Code:
else if {
$error = "<span class='colorTextRed'>&nbsp;&nbsp;&nbsp;E-mail NOT sent</span>";
    }
It is only seeing the else, because you don't have any conditions on the if. You either have to change it to just an else statement, or add some conditions to the if. Judging by your code I am guessing you want this to just be an else statement.
I did think of that & tried changing "else if" to just "else" but to all in vain, I'm afraid. Its still showing the errors, I fear.

I've updated my code with comments all over it, making it easier to read now:

PHP Code:
<?php
include("banner.inc");
include(
"template.inc");
include(
"rightcontent.inc");
?>

<div id="centerContent">

<?php

// If the form has been posted, analyse it:
if ($_POST) { // CURLY BRACKET (Open): After Clicking Submit
    
foreach ($_POST as $field => $value) {
        
$value = trim($value);
       }

// Creating Variables
    
$to="contact@allinclusivewebdesign.byethost13.com";
    
$inquiry=$_POST['inquiry'];
    
$title=$_POST['title'];
    
$first_name=$_POST['first_name'];
    
$last_name=$_POST['last_name'];
    
$email=$_POST['email'];
    
$phone=$_POST['phone'];
    
$message=stripslashes($_POST['message']);
    
$reply=$_POST['reply'];
    
$contact=$_POST['contact'];

    
$headers="From: " . $_POST['email'] . "\r\n" .
    
"Inquiry: " . $_POST['inquiry'] . "\r\n" .
    
"Title: " . $_POST['title'] . "\r\n" .  
    
"First Name: " . $_POST['first_name'] . "\r\n" .
    
"Last Name: " . $_POST['last_name'] . "\r\n" .
    
"E-mail: " . $_POST['email'] . "\r\n" .
    
"Phone: " . $_POST['phone'] . "\r\n" .
    
"Message: " . $_POST['message'] . "\r\n" .
    
"Reply: " . $_POST['reply'] . "\r\n" .
    
"Contact: " . $_POST['contact'];


// Create empty ERROR variables
    
$error = ""; // for fields left BLANK
    
$errorflag = ""; // for fields with INVALID data entered
    
// Check for field/fields that is/are left BLANK
    
if (($first_name == "") || ($last_name == "") || ($email == "") || ($phone == "") || ($message == "")) { // CURLY BRACKET (Open): For Validating if fields are left blank
        
$error = "<span class='colorTextBlue'>Please fill in all fields!</span>";
    }
// CURLY BRACKET (Close): For Validating if fields are left blank
    
    
else { // CURLY BRACKET (Open): Form Validation
    // Validate First Name (including ERRORS such as (1) field left BLANK (2) field with INVALID data entered
        
if (ctype_alpha($first_name) == FALSE)  {
            
$error = "<span class='colorTextBlue'>Please enter a valid First Name <span class='italic'>(Alphabets only)</span></span>";
            
$errorflag= "first_name";
            }
    
// Validate Last Name (including ERRORS such as (1) field left BLANK (2) field with INVALID data entered
        
else if (ctype_alpha($last_name) == FALSE) {
            
$error = "<span class='colorTextBlue'>Please enter a valid Last Name <span class='italic'>(Alphabets only)</span></span>";
            
$errorflag="last_name";
            }
    
// Validate E-mail (including ERRORS such as (1) field left BLANK (2) field with INVALID data entered
        
else if ((strpos($email, "@") == FALSE)||
            (
strpos($email, ".") == FALSE) ||
            (
strpos($email, " ") != FALSE)) {
                
$error = "<span class='colorTextBlue'>Please enter a valid E-mail</span>";
                
$errorflag="email";
            }
    
// Validate Contact No. (including ERRORS such as (1) field left BLANK (2) field with INVALID data entered
        
else if (is_numeric($phone) == FALSE) {
            
$error = "<span class='colorTextBlue'>Please enter a valid Contact No. <span class='italic'>(must contain numbers only)</span></span>";
            
$errorflag="phone";
            }
    }
// CURLY BRACKET (Close): Form Validation
    
    // Confirmation Message seen AFTER filling the form and pressing "Submit" button (whether there's an error or not)
    // If there's an error along with displaying the list of flagged error/errors
    
if ($error != "") {    // CURLY BRACKET (Open): For Error
    
echo "<br/>&nbsp;&nbsp;&nbsp;<b><span class='colorTextRed'>Error Occured: </b>" . $error."</span>" ;
                    }
// CURLY BRACKET (Close): For Error
                    

    // If there's NO error at all, along with displaying the filled fields
    
else if (mail($to, $subject, $message, $headers));
{
        echo
"<p><span class='colorTextBlue'>E-mail sent successfully</span></p>";
        echo
"<p>Thanks for your comment and time. We will be in touch with you shortly, if required. Following are the details you filled in.<br/><br/>";
        echo
"<b>Nature of Inquiry:</b> ". $inquiry . "<br/>";
        echo
"<b>Title:</b> ". $title . "<br/>";
        echo
"<b>First Name:</b> ". $first_name . "<br/>";
        echo
"<b>Last Name:</b> ". $last_name . "<br/>";
        echo
"<b>E-mail:</b> ". $email . "<br/>";
        echo
"<b>Contact No.:</b> ". $phone . "<br/>";
        echo
"<b>Message:</b> ". $message . "<br/>";
        echo
"<b>Reply:</b> ". $reply . "<br/>";
        echo
"<b>Contact Method:</b> ". $contact . "<br/></p>";
            }
    else {
$error = "<span class='colorTextRed'>&nbsp;&nbsp;&nbsp;E-mail NOT sent</span>";
    }
}
// CURLY BRACKET (Close): After Clicking Submit

// Displays the Empty variables i.e. when the Contact Form appears completely blank for the VERY FIRST time with all blank fields
else {

    
$inquiry = "";
    
$title = "";
    
$first_name = "";
    
$last_name = "";
    
$email = "";
    
$phone = "";
    
$message = "";
    
$reply = "";
    
$contact = "";
    
$errorflag = "";
}
?>

<p class="first-letter">Please fill the following form in for any enquiries that you may have:</p>

<table id="contactTable">

<tr id="contactTable">
<td id="contactTable"><form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
Nature of Enquiry:</td>
<td id="contactTable"><select name="inquiry" class="contactForm">
<option <?php if ($inquiry == "General Inquiry") echo "Selected"; ?> value = "General Inquiry">General Inquiry</option>
<option <?php if ($inquiry == "Price Quotation") echo "Selected"; ?> value = "Price Quotation">Price Quotation</option>
<option <?php if ($inquiry == "Comments") echo "Selected"; ?> value = "Comments">Comments</option>
<option <?php if ($inquiry == "Other") echo "Selected"; ?> value = "Other">Other</option>
</select></td>
</tr>

<tr id="contactTable">
<td id="contactTable">Title:</td>
<td id="contactTable"><select name="title" class="contactForm"/>
<option <?php if ($title == "Mr") echo "Selected"; ?> value = "Mr">Mr</option>
<option <?php if ($title == "Miss") echo "Selected"; ?> value = "Miss">Miss</option>
<option <?php if ($title == "Ms") echo "Selected"; ?> value = "Ms">Ms</option>
<option <?php if ($title == "Mrs") echo "Selected"; ?> value = "Mrs">Mrs</option>
<option <?php if ($title == "Other") echo "Selected"; ?> value = "Other">Other</option>
</select></td>
</tr>

<tr id="contactTable">
<td id="contactTable"><?php if ($errorflag == "first_name") { echo "<span class='colorTextRed'>First Name:</span>"; }
                        else { echo
"First Name:"; } ?></td>
<td id="contactTable"><input type="text" size="30" maxlength="30" name="first_name" value="<?php echo $first_name; ?>" class="contactForm"/></td>
</tr>

<tr id="contactTable">
<td id="contactTable"><?php if ($errorflag == "last_name") { echo "<span class='colorTextRed'>Last Name:</span>"; }
                        else { echo
"Last name:"; } ?></td>
<td id="contactTable"><input type="text" size="30" maxlength="30" name="last_name" value="<?php echo $last_name; ?>" class="contactForm"/></td>
</tr>

<tr id="contactTable">
<td id="contactTable"><?php if ($errorflag == "email") { echo "<span class='colorTextRed'>E-mail:</span>"; }
                        else { echo
"E-mail:"; } ?></td>
<td id="contactTable"><input type="text" size="30" maxlength="30" name="email" value="<?php echo $email; ?>" class="contactForm"/></td>
</tr>

<tr id="contactTable">
<td id="contactTable"><?php if ($errorflag == "phone") { echo "<span class='colorTextRed'>Contact No.:</span>"; }
                        else { echo
"Contact No.:"; } ?></td>
<td id="contactTable"><input type="text" size="30" maxlength="20" name="phone" value="<?php echo $phone; ?>" class="contactForm"/></td>
</tr>

<tr id="contactTable">
<td id="contactTable">Message:</td>
<td id="contactTable"><textarea rows="10" cols="50" wrap="physical" name="message" class="contactForm"/><?php echo $message; ?>
</textarea></td>
</tr>

<tr id="contactTable">
<td id="contactTable">Reply Required:</td>
<td id="contactTable"><input type="radio" name="reply" value="Yes" checked="checked"/>Yes
<input type="radio" name="reply" value="No" <?php if ($reply=="No") echo "checked='checked'"; ?>/>No</td>
</tr>

<tr id="contactTable">
<td id="contactTable">How would you like to be contacted <span class="italic">(if required)</span>?<br/><br/></td>
<td id="contactTable"><input type="radio" name="contact" value="Email" checked="checked"/>E-mail
<input type="radio" name="contact" value="Telephone" <?php if ($contact=="Telephone") echo "checked='checked'"; ?>/>Telephone
</td>
</tr>

<tr id="contactTable">
<td id="contactTable"></td>
<td id="contactTable"><input type="reset" name="reset" value="Reset">
<input type="submit" name="submit" value="Submit"></td>
</form>
</tr>
</table>
</div>

<?php include("footer.inc");?>
j4mes_bond25 is offline   Reply With Quote
Old 07-08-2006, 08:24 AM   #7
Weedpacket
Custom User Title™
 
Weedpacket's Avatar
 
Join Date: Aug 2002
Location: Rapid Offensive Unit "Foreign Object Damage"
Posts: 19,479
PHP Code:
    else if (mail($to, $subject, $message, $headers));
If you dropped the semicolon on the end of that line PHP won't interpret it as the end of the statement "if mail() succeeds, do nothing".
__________________
On two occasions I have been asked [by Members of Parliament], "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.

Last edited by Weedpacket; 07-08-2006 at 08:30 AM.
Weedpacket is offline   Reply With Quote
Old 07-08-2006, 09:38 AM   #8
Houdini
Lost in Time (1970's)
 
Houdini's Avatar
 
Join Date: Jul 2004
Location: Nashville TN USA
Posts: 1,932
You will have problems with your $error and $errorflag variable if there is more than one error and the only error that will show is the very last one and the same thing with the $errorflag.
After the first error you need to concatenate the $error and $errorflag using $error .= and $errorflag .= you might want to include a <br /> at the end of each $error and $errorflag also so when printing them they are not all running together.
Houdini is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 09:23 AM.






Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.