Jump to content

[SOLVED] contact us form problems


HNX

Recommended Posts

  • Replies 121
  • Created
  • Last Reply

Top Posters In This Topic

<?php
if(isset($_POST['Submit'])){
	$to = "YOUR HOTMAIL ADDRESS";
	$subject = $_POST['subject'];
	$message = $_POST['detail'];
	$from = $_POST['name'];
	$headers = "From: $from";
	if(mail($to,$subject,$message,$headers)) {
		//echo "Thank you for your interest, your e-mail was sent.";
                        header("Location: success.php"); // change "sucess.php" to the page you want them to be redirected to; if email is submitted successfully.
                        exit;
	}

}

	print '<form action="" method=post name=form1 id=form1>';
	print '<table width="100%" border="0" cellspacing="1" cellpadding="3">';
	print '<tr>';
	print '<td width="16%"><span class="style108">Subject</span></td>';
	print '<td width="2%"><span class="style104">:</span></td>';
	print '<td width="82%"><input name="subject" type="text" id="subject" size="50" /></td>';
	print '</tr>';
	print '<tr>';
	print '<td><span class="style108">Message</span></td>';
	print '<td><span class="style104">:</span></td>';
	print '<td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>';
	print '</tr>';
	print '<tr>';
	print '<td><span class="style108">Name</span></td>';
	print '<td><span class="style104">:</span></td>';
	print '<td><input name="name" type="text" id="name" size="50" /></td>';
	print '</tr>';
	print '<tr>';
	print '<td><span class="style108">Email</span></td>';
	print '<td><span class="style104">:</span></td>';
	print '<td><input name="customer_mail" type="text" id="customer_mail" size="50" /></td>';
	print '</tr>';
	print '<tr>';
	print '<td> </td>';
	print '<td> </td>';
	print '<td><input type="submit" name="Submit" value="Submit" />';
	print '<input type="reset" name="Submit2" value="Reset" /></td>';
	print '</tr>';
	print '</table>';
	print '</form>';

?>

 

does it have to be a php file??  and when u say "change "sucess.php" to the page you want them to be redirected to; if email is submitted successfully." thats what i should write?? so does it mean i can remove this from the code afterwards???

Link to comment
Share on other sites

<?php
if(isset($_POST['Submit'])){
	$to = "YOUR HOTMAIL ADDRESS";
	$subject = $_POST['subject'];
	$message = $_POST['detail'];
	$from = $_POST['name'];
	$headers = "From: $from";
	if(mail($to,$subject,$message,$headers)) {
		//echo "Thank you for your interest, your e-mail was sent.";
                        header("Location: success.php"); // change "sucess.php" to the page you want them to be redirected to; if email is submitted successfully.
                        exit;
	}

}

	print '<form action="" method=post name=form1 id=form1>';
	print '<table width="100%" border="0" cellspacing="1" cellpadding="3">';
	print '<tr>';
	print '<td width="16%"><span class="style108">Subject</span></td>';
	print '<td width="2%"><span class="style104">:</span></td>';
	print '<td width="82%"><input name="subject" type="text" id="subject" size="50" /></td>';
	print '</tr>';
	print '<tr>';
	print '<td><span class="style108">Message</span></td>';
	print '<td><span class="style104">:</span></td>';
	print '<td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>';
	print '</tr>';
	print '<tr>';
	print '<td><span class="style108">Name</span></td>';
	print '<td><span class="style104">:</span></td>';
	print '<td><input name="name" type="text" id="name" size="50" /></td>';
	print '</tr>';
	print '<tr>';
	print '<td><span class="style108">Email</span></td>';
	print '<td><span class="style104">:</span></td>';
	print '<td><input name="customer_mail" type="text" id="customer_mail" size="50" /></td>';
	print '</tr>';
	print '<tr>';
	print '<td> </td>';
	print '<td> </td>';
	print '<td><input type="submit" name="Submit" value="Submit" />';
	print '<input type="reset" name="Submit2" value="Reset" /></td>';
	print '</tr>';
	print '</table>';
	print '</form>';

?>

 

does it have to be a php file??  and when u say "change "sucess.php" to the page you want them to be redirected to; if email is submitted successfully." thats what i should right/?? so does it mean i can remove this from the code afterwards???

 

LOL, Everytime we change the script you have to replace the old one with this one.

 

Change the part where it says success.php to the page you want the users to be redirected.

Link to comment
Share on other sites

well did u see the page i sent?? i mean the link ???

 

thats exactly what i want so all i have to do is make the script go to the contact us page/??/ and the script will tell the dude itself that ur message was sent on the same page right??

 

check the site i gave u  (http://www.elico.ca/main.cfm?p=40&l=fr)

 

If thats what you want, then you have to send the user to another page, validate the data sent, and give him a message if the form was sent, or redirect if there was an error.

 

Just use the script we gave you.

Link to comment
Share on other sites

Try this

 

<?php
if(isset($_POST['Submit'])){
	$to = "YOUR HOTMAIL ADDRESS";
	$subject = $_POST['subject'];
	$message = $_POST['detail'];
	$from = $_POST['name'];
	$headers = "From: $from";

if(($to == "")||($subject == "")||($message == "")||($from == "")){

echo "Please fill in all the fields";

}
else{
	if(mail($to,$subject,$message,$headers)) {
		//echo "Thank you for your interest, your e-mail was sent.";
                        header("Location: success.php"); // change "sucess.php" to the page you want them to be redirected to; if email is submitted successfully.
                        exit;
	}
                   
                   }

}

	print '<form action="" method=post name=form1 id=form1>';
	print '<table width="100%" border="0" cellspacing="1" cellpadding="3">';
	print '<tr>';
	print '<td width="16%"><span class="style108">Subject</span></td>';
	print '<td width="2%"><span class="style104">:</span></td>';
	print '<td width="82%"><input name="subject" type="text" id="subject" size="50" /></td>';
	print '</tr>';
	print '<tr>';
	print '<td><span class="style108">Message</span></td>';
	print '<td><span class="style104">:</span></td>';
	print '<td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>';
	print '</tr>';
	print '<tr>';
	print '<td><span class="style108">Name</span></td>';
	print '<td><span class="style104">:</span></td>';
	print '<td><input name="name" type="text" id="name" size="50" /></td>';
	print '</tr>';
	print '<tr>';
	print '<td><span class="style108">Email</span></td>';
	print '<td><span class="style104">:</span></td>';
	print '<td><input name="customer_mail" type="text" id="customer_mail" size="50" /></td>';
	print '</tr>';
	print '<tr>';
	print '<td> </td>';
	print '<td> </td>';
	print '<td><input type="submit" name="Submit" value="Submit" />';
	print '<input type="reset" name="Submit2" value="Reset" /></td>';
	print '</tr>';
	print '</table>';
	print '</form>';

?>

Link to comment
Share on other sites

ok first let me undertand how to make the page "success.php" so what i need to do is copy my contact page and remove the form and write instead " your msg was sent" right?

 

@phpquestioner : euh i dont know how to do that... do u have any suggestions for where to learn php

Link to comment
Share on other sites

@phpquestioner : euh i dont know how to do that... do u have any suggestions for where to learn php

 

yeah - try your local books store - that's a start - go out and get you a php book for beginners - also search  google for some php beginner tutorial.

 

you can also learn from other people's threads on this and other php forums.

 

Link to comment
Share on other sites

huh will that do the work???

btw my question was as follows

ok first let me undertand how to make the page "success.php" so what i need to do is copy my contact page and remove the form and write instead " your msg was sent" right?

 

i asked i have to make the file but then ur tellin me to replace somethin?!!

 

im puzzled!!:|

Link to comment
Share on other sites

huh will that do the work???

btw my question was as follows

ok first let me undertand how to make the page "success.php" so what i need to do is copy my contact page and remove the form and write instead " your msg was sent" right?

 

i asked i have to make the file but then ur tellin me to replace somethin?!!

 

im puzzled!!:|

 

I know what you ment,

 

use this script

 

<?php
if(isset($_POST['Submit'])){
	$to = "YOUR HOTMAIL ADDRESS";
	$subject = $_POST['subject'];
	$message = $_POST['detail'];
	$from = $_POST['name'];
	$headers = "From: $from";

if(($to == "")||($subject == "")||($message == "")||($from == "")){

echo "Please fill in all the fields";

}
else{
	if(mail($to,$subject,$message,$headers)) {
		//echo "Thank you for your interest, your e-mail was sent.";
                        die("Your message was sent to ".$to." successfuly"); // change "sucess.php" to the page you want them to be redirected to; if email is submitted successfully.
                        exit;
	}
                   
                   }

}

	print '<form action="" method=post name=form1 id=form1>';
	print '<table width="100%" border="0" cellspacing="1" cellpadding="3">';
	print '<tr>';
	print '<td width="16%"><span class="style108">Subject</span></td>';
	print '<td width="2%"><span class="style104">:</span></td>';
	print '<td width="82%"><input name="subject" type="text" id="subject" size="50" /></td>';
	print '</tr>';
	print '<tr>';
	print '<td><span class="style108">Message</span></td>';
	print '<td><span class="style104">:</span></td>';
	print '<td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>';
	print '</tr>';
	print '<tr>';
	print '<td><span class="style108">Name</span></td>';
	print '<td><span class="style104">:</span></td>';
	print '<td><input name="name" type="text" id="name" size="50" /></td>';
	print '</tr>';
	print '<tr>';
	print '<td><span class="style108">Email</span></td>';
	print '<td><span class="style104">:</span></td>';
	print '<td><input name="customer_mail" type="text" id="customer_mail" size="50" /></td>';
	print '</tr>';
	print '<tr>';
	print '<td> </td>';
	print '<td> </td>';
	print '<td><input type="submit" name="Submit" value="Submit" />';
	print '<input type="reset" name="Submit2" value="Reset" /></td>';
	print '</tr>';
	print '</table>';
	print '</form>';

?>

Link to comment
Share on other sites

ok it says :

Your message was sent to someone@hotmail.com successfuly

 

i dont want the people to see my email :s

 

oh and i delete this part

// change "sucess.php" to the page you want them to be redirected to; if email is submitted successfully.
Link to comment
Share on other sites

ok it says :

Your message was sent to someone@hotmail.com successfuly

 

i dont want the people to see my email :s

 

Try this then

 

<?php
if(isset($_POST['Submit'])){
	$to = "YOUR HOTMAIL ADDRESS";
	$subject = $_POST['subject'];
	$message = $_POST['detail'];
	$from = $_POST['name'];
	$headers = "From: $from";

if(($to == "")||($subject == "")||($message == "")||($from == "")){

echo "Please fill in all the fields";

}
else{
	if(mail($to,$subject,$message,$headers)) {
		//echo "Thank you for your interest, your e-mail was sent.";
                        die("Thank you for your interest, your e-mail was sent."); 
	}
                   
                   }

}

	print '<form action="" method=post name=form1 id=form1>';
	print '<table width="100%" border="0" cellspacing="1" cellpadding="3">';
	print '<tr>';
	print '<td width="16%"><span class="style108">Subject</span></td>';
	print '<td width="2%"><span class="style104">:</span></td>';
	print '<td width="82%"><input name="subject" type="text" id="subject" size="50" /></td>';
	print '</tr>';
	print '<tr>';
	print '<td><span class="style108">Message</span></td>';
	print '<td><span class="style104">:</span></td>';
	print '<td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>';
	print '</tr>';
	print '<tr>';
	print '<td><span class="style108">Name</span></td>';
	print '<td><span class="style104">:</span></td>';
	print '<td><input name="name" type="text" id="name" size="50" /></td>';
	print '</tr>';
	print '<tr>';
	print '<td><span class="style108">Email</span></td>';
	print '<td><span class="style104">:</span></td>';
	print '<td><input name="customer_mail" type="text" id="customer_mail" size="50" /></td>';
	print '</tr>';
	print '<tr>';
	print '<td> </td>';
	print '<td> </td>';
	print '<td><input type="submit" name="Submit" value="Submit" />';
	print '<input type="reset" name="Submit2" value="Reset" /></td>';
	print '</tr>';
	print '</table>';
	print '</form>';

?>

 

Link to comment
Share on other sites

euh thats the same thing as before....remember the website i showed?? thats wht i need,

 

i dont want it to go to a blank page but instead to load on the same page....if iu understand what i mean?

 

hopelessly Lol,

HNX

Link to comment
Share on other sites

euh thats the same thing as before....remember the website i showed?? thats wht i need,

 

i dont want it to go to a blank page but instead to load on the same page....if iu understand what i mean?

 

hopelessly Lol,

HNX

 

o lol, well we already gave you a script that does that.

 

try

 

<?php
if(isset($_POST['Submit'])){
	$to = "YOUR HOTMAIL ADDRESS";
	$subject = $_POST['subject'];
	$message = $_POST['detail'];
	$from = $_POST['name'];
	$headers = "From: $from";

if(($to == "")||($subject == "")||($message == "")||($from == "")){

echo "Please fill in all the fields";

}
else{
	if(mail($to,$subject,$message,$headers)) {
		//echo "Thank you for your interest, your e-mail was sent.";
                   echo "Thank you for your interest, your e-mail was sent."; 
	}
                   
                   }

}

	print '<form action="" method=post name=form1 id=form1>';
	print '<table width="100%" border="0" cellspacing="1" cellpadding="3">';
	print '<tr>';
	print '<td width="16%"><span class="style108">Subject</span></td>';
	print '<td width="2%"><span class="style104">:</span></td>';
	print '<td width="82%"><input name="subject" type="text" id="subject" size="50" /></td>';
	print '</tr>';
	print '<tr>';
	print '<td><span class="style108">Message</span></td>';
	print '<td><span class="style104">:</span></td>';
	print '<td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>';
	print '</tr>';
	print '<tr>';
	print '<td><span class="style108">Name</span></td>';
	print '<td><span class="style104">:</span></td>';
	print '<td><input name="name" type="text" id="name" size="50" /></td>';
	print '</tr>';
	print '<tr>';
	print '<td><span class="style108">Email</span></td>';
	print '<td><span class="style104">:</span></td>';
	print '<td><input name="customer_mail" type="text" id="customer_mail" size="50" /></td>';
	print '</tr>';
	print '<tr>';
	print '<td> </td>';
	print '<td> </td>';
	print '<td><input type="submit" name="Submit" value="Submit" />';
	print '<input type="reset" name="Submit2" value="Reset" /></td>';
	print '</tr>';
</table>';
</form>';

?>

Link to comment
Share on other sites

my bad..

 

try

 

<?php
if(isset($_POST['Submit'])){
	$to = "YOUR HOTMAIL ADDRESS";
	$subject = $_POST['subject'];
	$message = $_POST['detail'];
	$from = $_POST['name'];
	$headers = "From: $from";

if(($to == "")||($subject == "")||($message == "")||($from == "")){

echo "Please fill in all the fields";

}
else{
	if(mail($to,$subject,$message,$headers)) {
		//echo "Thank you for your interest, your e-mail was sent.";
                   echo "Thank you for your interest, your e-mail was sent."; 
	}
                   
                   }

}

	print '<form action="" method=post name=form1 id=form1>';
	print '<table width="100%" border="0" cellspacing="1" cellpadding="3">';
	print '<tr>';
	print '<td width="16%"><span class="style108">Subject</span></td>';
	print '<td width="2%"><span class="style104">:</span></td>';
	print '<td width="82%"><input name="subject" type="text" id="subject" size="50" /></td>';
	print '</tr>';
	print '<tr>';
	print '<td><span class="style108">Message</span></td>';
	print '<td><span class="style104">:</span></td>';
	print '<td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>';
	print '</tr>';
	print '<tr>';
	print '<td><span class="style108">Name</span></td>';
	print '<td><span class="style104">:</span></td>';
	print '<td><input name="name" type="text" id="name" size="50" /></td>';
	print '</tr>';
	print '<tr>';
	print '<td><span class="style108">Email</span></td>';
	print '<td><span class="style104">:</span></td>';
	print '<td><input name="customer_mail" type="text" id="customer_mail" size="50" /></td>';
	print '</tr>';
	print '<tr>';
	print '<td> </td>';
	print '<td> </td>';
	print '<td><input type="submit" name="Submit" value="Submit" />';
	print '<input type="reset" name="Submit2" value="Reset" /></td>';
	print '</tr>';
                print'</table>';
                print'</form>';

?>

Link to comment
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.