Jump to content

Contact Form


realife

Recommended Posts

Hey, I have my contact form in my website working fine

I'm just asking a simple question because I don't know so much about php and php syntax

 

I have my html file calling this code below when i'm clicking on the submit button

Just take a look at the last line when there is the 'echo' script

I want it to go to this link, and instead it's just writing the link

what is the right command/code that should i use?

 

 

<?
$subject="from ".$_GET['fName'];
$headers= "From: ".$_GET['fEmail']."\n";
$headers.='Content-type: text/html; charset=UTF-8' . "\r\n";
mail("[email protected]", $subject,  "
<html>
<head>
<title> My Title </title>
</head>
<body>

<br>
  ".$_GET['fName']. " <br>
  ".$_GET['fPhone']." <br>
  ".$_GET['fEmail']."  <br><br>
  ".$_GET['pBody']." 

</body>
</html>" , $headers);

echo "http://avrikim123.co.cc/sent.html";
?>

Link to comment
https://forums.phpfreaks.com/topic/222616-contact-form/
Share on other sites

<?
$subject="from ".$_GET['fName'];
$headers= "From: ".$_GET['fEmail']."\n";
$headers.='Content-type: text/html; charset=UTF-8' . "\r\n";
mail("[email protected]", $subject,  "
<html>
<head>
<title> My Title </title>
</head>
<body>

<br>
  ".$_GET['fName']. " <br>
  ".$_GET['fPhone']." <br>
  ".$_GET['fEmail']."  <br><br>
  ".$_GET['pBody']." 

</body>
</html>" , $headers);

header("Location: http://avrikim123.co.cc/sent.html");
?>

Link to comment
https://forums.phpfreaks.com/topic/222616-contact-form/#findComment-1151291
Share on other sites

If you mean you want the user redirected after submission you should use a header redirect. You will however need to make sure there is no output sent to the browser before the header.

 

That would mean no markup and no whitespace at all can be sent prior to header().

Link to comment
https://forums.phpfreaks.com/topic/222616-contact-form/#findComment-1151299
Share on other sites

I don't know what output you talking about..

I just have my php file, and the html calling it:

 

 

 

My form code in the HTML file:

 

<form action="contact.php" method="get"  enctype="multipart/form-data" id="form">

My form goes here

<a href="#" onClick="document.getElementById('form').submit()">
<span class="style5"><input type="image" src="images/submit.jpg" /></span></a>

</form>


 

Link to comment
https://forums.phpfreaks.com/topic/222616-contact-form/#findComment-1151304
Share on other sites

You have blank line/new line at the top of your php script, that is causing the problem because that newline is getting sent to the browser before your php code is executed. Normally that would work but because you are setting a header (content-type) the error is thrown. No output can be sent to the browser before custom headers.

Link to comment
https://forums.phpfreaks.com/topic/222616-contact-form/#findComment-1151402
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.