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("mymail@example.com", $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
Share on other sites

<?
$subject="from ".$_GET['fName'];
$headers= "From: ".$_GET['fEmail']."\n";
$headers.='Content-type: text/html; charset=UTF-8' . "\r\n";
mail("mymail@example.com", $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
Share on other sites

No, that's not working good, i'm getting error

 

Warning: Cannot modify header information - headers already sent by (output started at /home/realife/domains//public_html/mavrikim/contact.php:2)

in /home/realife/domains//public_html/mavrikim/contact.php on line 22

 

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