PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old September 21st, 2002, 05:56 AM
legion legion is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Auckland, New Zealand
Posts: 6 legion User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How would I do this?

I want some user to type their name in in a box,
and when they press sumbit, their answer gets mailed to tree@world-net.co.nz as well as going to a page that says

"Your name is [insert name they typed here]

your messeged has been mailed (or something)"

How would I go about making a script like that? thank you so much!

Reply With Quote
  #2  
Old September 21st, 2002, 06:24 AM
Nimco Nimco is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 132 Nimco User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to Nimco
RE: How would I do this?

name.htm:
php Code:
Original - php Code
  1.  
  2. <form method="post" action="mail.php">
  3. Name: <input type="text" name="name" size="30">
  4. <input type="submit" value="Send">
  5. </form>


mail.php:
php Code:
Original - php Code
  1.  
  2. <?php
  3.  if ($_POST['name'])
  4.   {
  5.    mail("tree@world-net.co.nz", "My Subject", "Name: $_POST['name']");
  6.    echo "Your name is " . $_POST['name'];
  7.   }
  8.  else
  9.   {
  10.    header("Location: name.htm");
  11.   }
  12. ?>

Reply With Quote
  #3  
Old September 21st, 2002, 08:37 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: How would I do this?

something iz wrongz

"

Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in Crogram FilesApache GroupApache2htdocstestmail.php on line 4
"

!>!?!?!?!?!?

Reply With Quote
  #4  
Old September 21st, 2002, 02:53 PM
mld mld is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Stockholm, Sweden
Posts: 5 mld User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 m
Reputation Power: 0
Send a message via ICQ to mld
RE: How would I do this?

The Location-header is supposed to have a complete URL (as per the PHP-manual). The corrected code would then be (in PHP4.1.2+):

Code:
<?php
 if ($_POST['name'])
  {
   mail("tree@world-net.co.nz", "My Subject", "Name: " . $_POST['name']);
   echo "Your name is " . $_POST['name'];
  }
 else
  {
   header('Location: http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/name.htm');
  }
?>

Reply With Quote
  #5  
Old September 21st, 2002, 03:29 PM
Nimco Nimco is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 132 Nimco User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via AIM to Nimco
RE: How would I do this?

btw, why isn't the [highlight=php] tag working?

Reply With Quote
  #6  
Old September 21st, 2002, 11:39 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: How would I do this?

now its saying

"Warning: Failed to Connect in Crogram FilesApache GroupApache2htdocstestmail.php on line 4"

!?!?!?!?!?!!!!!?

Reply With Quote
  #7  
Old September 21st, 2002, 11:48 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: How would I do this?

eeeeee nevermind it workz in a web server just not on my local server

thank you great php godz!

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > How would I do this?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway