PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

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 Dev Shed Forums Sponsor:
  #1  
Old December 20th, 2012, 02:35 AM
luxpc luxpc is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 4 luxpc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 18 sec
Reputation Power: 0
Tell a friend with teaxtarea!

Does anybody know how to implement in this form <textarea> ?
Code:
http://imgur.com/dt1ap

PHP Code:
<?php
if (isset($_POST['Submit'])) {
// This will check to see if the form has been submitted
$senders_email $_POST['your_email'];
// The person who is submitting the form
$recipient_friend $_POST['friend_email'];
// The forms recipient
mail($recipient_friend,"A message from $senders_email""Dear $recipient_friend,\n\nYour friend $senders_email, found our site very useful, and thought you would be interested.\n\nPlease follow the link to view our site:\n(URL address blocked: See forum rules)\n\nThank You\n\nThe your_sites_address.com"'From: "your_site" <your_email.com>');

if (isset(
$_POST['your_email'])) {
echo 
"<br>Your friend $recipient_friend has been contacted <br><br>Thank you $senders_email";
}}
?>


Code:
<form action="tell_a_friend.php" method="POST">
<fieldset>
<legend>Tell a friend</legend><br />
Your email<br />
<input type="text" name="your_email" value="Your email" /><br /><br />
Your Friends email<br />
<input type="text" name="friend_email" value="Your friends email" />
<input type="Submit" value="Tell a friend" name="Submit" />
</fieldset>
</form>

Reply With Quote
  #2  
Old December 20th, 2012, 04:41 AM
gw1500se gw1500se is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jul 2003
Posts: 2,867 gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Year 1 Week 5 Days 9 h 6 m 6 sec
Reputation Power: 581
Looks like you already have. What is not working?
__________________
There are 10 kinds of people in the world. Those that understand binary and those that don't.

Reply With Quote
  #3  
Old December 20th, 2012, 07:09 AM
luxpc luxpc is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 4 luxpc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 18 sec
Reputation Power: 0
Quote:
Originally Posted by gw1500se
Looks like you already have. What is not working?


yes in html I know how to add this field but I do not know how to include its value in the email (php)

Reply With Quote
  #4  
Old December 20th, 2012, 07:14 AM
gw1500se gw1500se is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jul 2003
Posts: 2,867 gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Year 1 Week 5 Days 9 h 6 m 6 sec
Reputation Power: 581
The same way you include any other value. You use $_POST with the name of the textarea (which you don't seem to have in your form).

Reply With Quote
  #5  
Old December 20th, 2012, 07:30 AM
ManiacDan's Avatar
ManiacDan ManiacDan is offline
Likely to be eaten by a grue.
Dev Shed God 10th Plane (9500 - 9999 posts)
 
Join Date: Oct 2006
Location: Pennsylvania, USA
Posts: 9,791 ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)  Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 2 Months 3 Weeks 14 h 53 m 20 sec
Reputation Power: 6112
Look at what you have:

<input type="text" name="your_email" value="Your email" /><br /><br />


Then in PHP:

$senders_email = $_POST['your_email'];


Do you see how the input name is the same as the post array key? That's how you do it. Give your input a name.
__________________
HEY! YOU! Read the New User Guide and Forum Rules

"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

"The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.

Reply With Quote
  #6  
Old December 20th, 2012, 07:51 AM
luxpc luxpc is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 4 luxpc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 18 sec
Reputation Power: 0
Quote:
Originally Posted by ManiacDan
Look at what you have:

<input type="text" name="your_email" value="Your email" /><br /><br />


Then in PHP:

$senders_email = $_POST['your_email'];


Do you see how the input name is the same as the post array key? That's how you do it. Give your input a name.


I have tried to do that but it doesn't work for me

my version ():

I includet in html:

Code:
<textarea id="message" name="url">
Your text here
</textarea>


And in php I included this code:

Code:
$message = $_POST['url'];



then I included this in mail body

Code:
mail($recipient_friend,"A message from $senders_email", "Dear $recipient_friend,\n\nYour friend $senders_email, $message found our site very useful, and thought you would be interested.\n\nPlease follow the link to view our site:\n(URL address blocked: See forum rules)\n\nThank You\n\nThe your_sites_address.com", 'From: "your_site" <your_email.com>');



But it doesn't work

Reply With Quote
  #7  
Old December 20th, 2012, 08:39 AM
ManiacDan's Avatar
ManiacDan ManiacDan is offline
Likely to be eaten by a grue.
Dev Shed God 10th Plane (9500 - 9999 posts)
 
Join Date: Oct 2006
Location: Pennsylvania, USA
Posts: 9,791 ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)  Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 2 Months 3 Weeks 14 h 53 m 20 sec
Reputation Power: 6112
This is how you debug:

1) Are you sure the textarea is named properly and properly formed? Inspect it in firebug or chrome inspector to see if those tools have a "name" attribute with "url" as the value.

2) If it is, make sure it's being included in the POST data. print_r($_POST) in your PHP to dump the post data to the screen, see if it's present.

3) If it's present, ensure your variable assignment is working. Echo $message before sending the email.

4) If $message is correct, double-check the spelling of your variables inside the mail() call. If they're correct, pull the entire email body out of that function call and make it a variable, then echo THAT to the screen as well.

Reply With Quote
  #8  
Old December 20th, 2012, 10:09 AM
luxpc luxpc is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 4 luxpc User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 54 m 18 sec
Reputation Power: 0
Quote:
Originally Posted by ManiacDan
This is how you debug:

1) Are you sure the textarea is named properly and properly formed? Inspect it in firebug or chrome inspector to see if those tools have a "name" attribute with "url" as the value.

2) If it is, make sure it's being included in the POST data. print_r($_POST) in your PHP to dump the post data to the screen, see if it's present.

3) If it's present, ensure your variable assignment is working. Echo $message before sending the email.

4) If $message is correct, double-check the spelling of your variables inside the mail() call. If they're correct, pull the entire email body out of that function call and make it a variable, then echo THAT to the screen as well.



Code:
 data. print_r($_POST)  
where should I search for it?


Can you please edit the existing code to make it work ok and submit here ? There are hundreds of scripts on the internet with tell a friend functions but they either do not work or doesn't have a text area. This one is perfect one it is so speedy and do not fall in spam box.

Please modify it for us , newbies

Reply With Quote
  #9  
Old December 20th, 2012, 10:30 AM
gw1500se gw1500se is offline
Contributing User
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jul 2003
Posts: 2,867 gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level)gw1500se User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 1 Year 1 Week 5 Days 9 h 6 m 6 sec
Reputation Power: 581
Since you didn't post existing code we can't. However, 'data.' is the end of ManiacDan's prevous sentence not part of the code. Anywhere before your first use of $_POST add this:
PHP Code:
echo "<pre>";
print_r($_POST);
echo 
"</pre>"

Reply With Quote
  #10  
Old December 20th, 2012, 10:42 AM
ManiacDan's Avatar
ManiacDan ManiacDan is offline
Likely to be eaten by a grue.
Dev Shed God 10th Plane (9500 - 9999 posts)
 
Join Date: Oct 2006
Location: Pennsylvania, USA
Posts: 9,791 ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)ManiacDan User rank is General 77th Grade (Above 100000 Reputation Level)  Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1Folding Points: 127430 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 2 Months 3 Weeks 14 h 53 m 20 sec
Reputation Power: 6112
Since you got to step 2, I assume you did step 1. gw is correct, I meant the code he said. Then, what you would search for, is the variable in question. In this case, an entry for "url" in the resulting printed array.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Tell a friend with teaxtarea!

Developer Shed Advertisers and Affiliates



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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap