PDA

View Full Version : Another Email problem -_- [+Rep]



Huggies
13-10-2010, 04:19 PM
Well my email submit form, is sending me blank emails! Please help!

I've already tried google.

HTML:

<form method="post" action="sendmail.php">

<!-- Personal Details -->
<fieldset>
<legend style="margin-bottom:0">Leave us a message!</legend>

<label style="padding-top: 1em">Name:</label>
<input type="text" title="Text input: First Name" name="Name" />

<label>Email:</label>
<input type="text" title="Text input: Email" name="email" />

<label>Phone:</label>
<input type="text" title="Text input: Phone" name="phone" />

<label>Message:</label>
<textarea rows="20" cols=""></textarea>
</fieldset>

<p><a href="sendmail.php" class="button-submit"></a></p>
</form>
</div>



PHP:

<?
$email = $_GET['email'] ;
$message = $_GET['message'] ;
mail( "[email protected]", "Email Subject", $message, "From: $email" );
print "Congratulations your email has been sent";
?>


Now i recive them, but the content in the email is blank, please help!

Jamesy
13-10-2010, 04:23 PM
I don't believe you've named your textarea

Huggies
13-10-2010, 04:24 PM
Can you tell me how? I IZ EPIC NOOB @ PHP :D

Cheers big ears

Jamesy
13-10-2010, 04:25 PM
<textarea rows="20" cols="" name="message"></textarea>

:)

Huggies
13-10-2010, 04:29 PM
<form method="post" action="sendmail.php">

<!-- Personal Details -->
<fieldset>
<legend style="margin-bottom:0">Leave us a message!</legend>

<label style="padding-top: 1em">Name:</label>
<input type="text" title="Text input: First Name" name="Name" />

<label>Email:</label>
<input type="text" title="Text input: Email" name="email" />
<textarea rows="20" cols="" name="email"></textarea>

<label>Subject</label>
<input type="text" title="Text input: Subject" name="subject" />
<textarea rows="20" cols="" name="subject"></textarea>

<label>Message:</label>
<textarea rows="20" cols=""></textarea>
<textarea rows="20" cols="" name="message"></textarea>
</fieldset>

<p><a href="sendmail.php" class="button-submit"></a></p>
</form>
</div>


So like that fine sir?

Jamesy
13-10-2010, 04:33 PM
you've got 2 textareas there, you can remove the top one :)

Huggies
13-10-2010, 04:35 PM
I don't understand could you re-write for me, when you got time sir. :D

Jamesy
13-10-2010, 04:37 PM
<form method="post" action="sendmail.php">

<!-- Personal Details -->
<fieldset>
<legend style="margin-bottom:0">Leave us a message!</legend>

<label style="padding-top: 1em">Name:</label>
<input type="text" title="Text input: First Name" name="Name" />

<label>Email:</label>
<input type="text" title="Text input: Email" name="email" />
<textarea rows="20" cols="" name="email"></textarea>

<label>Subject</label>
<input type="text" title="Text input: Subject" name="subject" />
<textarea rows="20" cols="" name="subject"></textarea>

<label>Message:</label>
<textarea rows="20" cols="" name="message"></textarea>
</fieldset>

<p><a href="sendmail.php" class="button-submit"></a></p>
</form>
</div>

Sorry I'm rather bad at explaining.

Huggies
13-10-2010, 04:42 PM
<!-- Personal Details -->
<fieldset>
<legend style="margin-bottom:0">Leave us a message!</legend>

<label style="padding-top: 1em">Name:</label>
<input type="text" title="Text input: First Name" name="Name" />

<label>Email:</label>
<input type="text" title="Text input: Email" name="email" />


<label>Subject</label>
<input type="text" title="Text input: Subject" name="subject" />


<label>Message:</label>
<textarea rows="20" cols="" name="message"></textarea>
</fieldset>

<p><a href="sendmail.php" class="button-submit"></a></p>
</form>
</div><!-- end content -->

Its totally fine, kind sir.


Can i do like that sir?

Jamesy
13-10-2010, 04:46 PM
oh yeah! Didn't see what had happened to the others.

Huggies
13-10-2010, 04:54 PM
Sorry for late reply young chap.

But can you help with another thing:


<?
$email = $_GET['email'] ;
$subject = $_GET['subject'] ;
$message = $_GET['message'] ;
mail( "[email protected]", "Email Subject", $subject, $message, "From: $email" );
print "Congratulations your email has been sent";
?>


layer it out in the email like:

Name
Subject
Email
Message


Thanks geez <3

Jamesy
13-10-2010, 05:01 PM
Ermm from the top of my head:



<?
$name = $_GET['name'] ;
$email = $_GET['email'] ;
$subject = $_GET['subject'] ;
$message = "Name: \r\n" . $name. "\r\n Subject:\r\n" . $subject . "\r\n Email: \r\n" . $email . "\r\n Message: \r\n" . $_GET['message'];
mail( "[email protected]", "Email Subject", $subject, $message, "From: $email" );
print "Congratulations your email has been sent";
?>

Huggies
13-10-2010, 05:04 PM
Mhmm, Cheers big ears.

Ill message if i need more help <3

Jamesy
13-10-2010, 05:06 PM
no worries (H)

Huggies
13-10-2010, 07:16 PM
Hey, im having problems, applications aren't comming to my email for some reason. Some help?

Dentafrice
14-10-2010, 02:28 AM
The problem I see is that your form method is set to post (method="post") and you are using $_GET to get it... ($_GET["message"]).. this would be true if your form method was get...

Try changing it to $_POST["message"] and you should have it :)

Huggies
14-10-2010, 02:16 PM
Thanks, but it still didn't work :o

Could anyone else help? :D

Dentafrice
15-10-2010, 11:36 AM
My post was one of the reasons it would not work... the second reason is you're not actually submitting the forum. An href does not submit the form, links just take you places... not provide an action....

You need an <input type="submit" value="Submit" /> to actually process the form... you could add name="myform" to your form tag... and then do...



<a href="#" onclick="javascript:document.myform.Submit();" />Submit</a>


That would do it too I think? Been so long since I've coded might not work... but you get the jist.

coolchris322
16-10-2010, 01:35 PM
change all the $_GET to $_POST['class'] where class is the name of the text area.

Shibby-Shabs
17-10-2010, 10:52 AM
EDIT // Damit ^ Didn't read


<form method="post" action="sendmail.php">

<!-- Personal Details -->
<fieldset>
<legend style="margin-bottom:0">Leave us a message!</legend>

<label style="padding-top: 1em">Name:</label>
<input type="text" title="Text input: First Name" name="Name" />

<label>Email:</label>
<input type="text" title="Text input: Email" name="email" />

<label>Phone:</label>
<input type="text" title="Text input: Phone" name="phone" />

<label>Message:</label>
<textarea rows="20" cols=""></textarea>
</fieldset>

<p><a href="sendmail.php" class="button-submit"></a></p>
</form>
</div>
You've got your method set as POST yet you are using $_GET['message']; so try changing it to $_POST['message']; do the same for the email as well so give the bottom code a try:


<?
$email = $_POST['email'] ;
$message = $_POST['message'] ;
mail( "[email protected]", "Email Subject", $message, "From: $email" );
print "Congratulations your email has been sent";
?>

Dentafrice
19-10-2010, 02:04 PM
You both just repeated exactly what I told him.. but he's still NOT submitting the form... a link doesn't submit it unless things have drastically changed

Want to hide these adverts? Register an account for free!