Old 08-08-2004   #1 (permalink)
Incredible Indelible Etiquette
 
Young Spartan's Avatar
 
Join Date: Oct 2003
Location: Hobe Sound, Florida
Posts: 1,751

Send a message via AIM to Young Spartan Send a message via MSN to Young Spartan Send a message via Yahoo to Young Spartan
PHP Mail Form Help..

index.php
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  
  <head>
  
  <title>| ShockedStyle |</title>
  
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  
  <link rel="stylesheet" type="text/css" href="http://www.shockedstyle.com/style.css" />
  
  </head>
  
  <body>
  
  <div class="zer">
  
  <div class="one">
  
 <br /><div class="two" align="center"><span id="two"><img src="http://shockedstyle.com/images/logo.gif" /><p><a href="http://www.shockedstyle.com">MAIN</a> | <a href="http://www.shockedstyle.com/blog">BLOG</a> | <a href="html://www.shockedstyle.com/contact">CONTACT</a></p></span>
  <div class="content">
  <?
  
{?>
  
      <form method="post" action="comments.php">
      E-Mail: <input type="text" name="email" size=60>
      Subject: <input type="text" name="subject" size=60>
      Comments: <textarea name="comments" rows="10" cols="30"></textarea>
      <input type="submit" name="submit" value="submit">
      </form>
  
  <? }?>
  </div>
  </div>
  
  <!-- one --></div>
  
  <!-- zer --></div>
  
  </body>
  
  </html>
comments.php
PHP Code:
<?
  
if($submit)
  {
      
mail("youremailaddress@whatever.com""$subject""$email""$comments");
  }
?>
It doesn't work... why?
Young Spartan is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 08-08-2004   #2 (permalink)
ahmedtheking
Guest
 
Posts: n/a

mail("youremailaddress@whatever.com", "$subject", "$comments", "'From: '.$email");

try that
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 08-08-2004   #3 (permalink)
Incredible Indelible Etiquette
 
Young Spartan's Avatar
 
Join Date: Oct 2003
Location: Hobe Sound, Florida
Posts: 1,751

Send a message via AIM to Young Spartan Send a message via MSN to Young Spartan Send a message via Yahoo to Young Spartan
Well, it's working now but when it comes in it is still coming in as from "Nobody" - how can I get it to come from their E-Mail Address?

*Waits for Ryan to tell me*
Young Spartan is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 08-08-2004   #4 (permalink)
ahmedtheking
Guest
 
Posts: n/a

by using the "from:" statement...

mail('youremail@domain.com',$subject,$text,"From: $name <$email>");

have a look at:

http://www.christian-web-masters.com...il-form-2.html

You'll get what I mean!
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 08-08-2004   #5 (permalink)
Incredible Indelible Etiquette
 
Young Spartan's Avatar
 
Join Date: Oct 2003
Location: Hobe Sound, Florida
Posts: 1,751

Send a message via AIM to Young Spartan Send a message via MSN to Young Spartan Send a message via Yahoo to Young Spartan
Now that is working.

But, at the end of each e-mail ($comments) it would be like this...

"Testing 1 2 3

."

What's with the little period at the end of each e-mail?
Young Spartan is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 08-09-2004   #6 (permalink)
ahmedtheking
Guest
 
Posts: n/a

check the $comments variable, can i see the code again please?
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 08-10-2004   #7 (permalink)
Incredible Indelible Etiquette
 
Young Spartan's Avatar
 
Join Date: Oct 2003
Location: Hobe Sound, Florida
Posts: 1,751

Send a message via AIM to Young Spartan Send a message via MSN to Young Spartan Send a message via Yahoo to Young Spartan
Index.php
PHP Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
 <head>
 
 <title>| ShockedStyle |</title>
 
 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
 
 <link rel="stylesheet" type="text/css" href="http://www.shockedstyle.com/style.css" />
 
 </head>
 
 <body>
 
 <div class="zer">
 
 <div class="one">
 
 <br /><div class="two" align="center"><span id="two"><img src="http://shockedstyle.com/images/logo.gif" /><p><a href="http://www.shockedstyle.com">MAIN</a> | <a href="http://www.shockedstyle.com/blog">BLOG</a> | <a href="html://www.shockedstyle.com/contact">CONTACT</a></p></span>
 <div class="content">
 <?
 
{?>
 
     <form method="post" action="comments.php">
     Name: <input type="text" name="name" size=60>
     E-Mail: <input type="text" name="email" size=60>
     Subject: <input type="text" name="subject" size=60>
     Comments: <textarea name="comments" rows="10" cols="30"></textarea>
     <input type="submit" name="submit" value="submit">
     </form>
 
 <? }?>
 </div>
 </div>
 
 <!-- one --></div>
 
 <!-- zer --></div>
 
 </body>
 
 </html>
Comments.php
PHP Code:
<?
 
if($submit)
 {
      
mail('yuneek@earthlink.net',$subject,$comments,"From: $name <$email>");
 }
?>
Young Spartan is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 08-11-2004   #8 (permalink)
ahmedtheking
Guest
 
Posts: n/a

Ah ive found out what it is!! u need to 'trim' the variables!!

like so:

$comments = trim($comments);

what 'trim' does is that it gets of extra spaces at the beginning and end of a string!

exactly what you need!
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 08-11-2004   #9 (permalink)
Incredible Indelible Etiquette
 
Young Spartan's Avatar
 
Join Date: Oct 2003
Location: Hobe Sound, Florida
Posts: 1,751

Send a message via AIM to Young Spartan Send a message via MSN to Young Spartan Send a message via Yahoo to Young Spartan
Can you show me how I could impliment that into this line exactly?

PHP Code:
<?
if($submit)
{
     
mail('yuneek@earthlink.net',$subject,$comments,"From: $name <$email>");
}
?>
Young Spartan is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 08-11-2004   #10 (permalink)
Local Biorust Beast
 
Order's Avatar
 
Join Date: Oct 2003
Location: San Diego, CA, USA
Posts: 2,253

Send a message via AIM to Order Send a message via MSN to Order Send a message via Yahoo to Order
trim handles spaces, not the period, which I am unsure why it is acting like that.

stick with what you have, but use the appropriate variables! Each variable is in the $_POST global scope, so do this:

PHP Code:
 if(isset($_POST['submit']))
{
     
mail('yuneek@earthlink.net'$_POST['subject'], $_POST['comments'], 'From: ' $_POST['name'] . '<' $_POST['email'] . '>');
}
else
{
     die(
"Nothing to do.. seems you got here by not using the form..");

This cleans things up a bit, sure it is more typing but there are less security holes, and you are adhereing to the register_globals rules.. when you use just $submit, php does not check to see if it form data, query string data, or cookie data, so someone can easy spoof and open up a security vulnerability in your code, always use your global vars for this stuff.. the common global vars can be found and explained at the PHP Manual:

http://www.php.net/manual/en/languag...predefined.php
__________________
Order is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Old 08-14-2004   #11 (permalink)
ahmedtheking
Guest
 
Posts: n/a

Oh with trim, before you carry the vars, put it at the top, so:

<?php

$comments = trim($comments);

if(isset($_POST['submit']))
{
mail('yuneek@earthlink.net', $_POST['subject'], $_POST['comments'], 'From: ' . $_POST['name'] . '<' . $_POST['email'] . '>');
}
else
{
die("Nothing to do.. seems you got here by not using the form..");

?>

(using the code from order, just a c+p job, but you get what i mean!)

Its like setting an array, you do it before you want to carry or print or use it!!
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT +1. The time now is 05:35 PM.
Content Relevant URLs by vBSEO 3.2.0

Design & Content © BioRUST 2008 :: PRIVACY STATEMENT :: LEGAL INFORMATION :: ADVERTISING MEDIA KIT