![]() | | ||||||||
| | #1 |
| Warrior Member War Room Member Join Date: Feb 2007 Location: New York , USA.
Posts: 8
Thanks: 0
Thanked 2 Times in 2 Posts
|
Can anyone suggest a very simple script that I can incorporate into my site for viewers to submit articles? This can be done via email it doesn't have to be complicated. The only thing that I would like is to have an html or text input so that articles can be edited on the fly. Any help would be appreciated. |
| www.homebusinessresearch.com Home Business help and resources. | |
| | |
| | #2 |
| Advanced Warrior War Room Member Join Date: May 2004 Location: Perth, Australia.
Posts: 717
Thanks: 4
Thanked 182 Times in 138 Posts
|
Hi.. An HTML form cannot send email. So to get the content out of an form and sent somwhere else (via email or whatever), it will have to go via a script that runs on your webserver. This script will have be be something like a PHP or ASP script. Below is the HTML code for a form that will display a form on a webpage (just insert code betwteen the <body> </body> tags of your html file, and then the following code will take the results of this form and email it to you. Please note; the PHP code is very basic, is does not error checking. It just takes the content and sends it to you. Nothing more!! It should be enough to get you going. Of cousre you will need to change the email address to the one you want to use. Replace the phrase PUT_YOUR_EMAIL_ADDRESS_HERE with your email address. Make sure the email address is surrounded by dingle quotes (the ' symbol) I hope this helps Bruce ----------------- HTML CODE OF FORM ------ <form method="POST" action="addarticle.php"> <table align="center" border="0" cellspacing="0" cellpadding="10" bgcolor="#FFFFFF"> <tr> <td valign="top" colspan="2"> <p align="center"><b><font face="Verdana" size="6">Add An Article</font></b></td> </tr> <tr> <td valign="top"><font face="Verdana" size="2">Article Title</font></td> <td><font face="Verdana"><input type="text" name="article_title" size="44"></font></td> </tr> <tr> <td valign="top"><font face="Verdana" size="2">Author's Full Name</font></td> <td><font face="Verdana"><input type="text" name="author_name" size="44"></font></td> </tr> <tr> <td valign="top"><font face="Verdana" size="2">Text<br> </font></td> <td><font face="Verdana"><textarea rows="18" name="article_text" cols="56"></textarea></font></td> </tr> <tr> <td valign="top"><font face="Verdana" size="2">First Name</font></td> <td><font face="Verdana"><input type="text" name="firstname" size="44"></font></td> </tr> <tr> <td valign="top"><font face="Verdana" size="2">Last Name</font></td> <td><font face="Verdana"><input type="text" name="lastname" size="44"></font></td> </tr> <tr> <td valign="top"><font face="Verdana" size="2">Your Email Address</font></td> <td><font face="Verdana"><input type="text" name="email" size="44"></font></td> </tr> <tr> <td colspan="2" align="center"> <font face="Verdana"> <input type="submit" value="Submit Article" name="submitarticle"></font></td> </tr> </table> </form> ---------------------- Cut and paste the following code into notepad, and then save as addarticle.php and FTP up to your server, and put in the same directory as your form is going to be in.. ----------------------------------- PHP CODE ------- <?php if (isset($_POST['submitarticle'])) { $subject = 'New Article'; $adate = date("F j, Y, g:i a"); $email = 'PUT_YOUR_EMAIL_ADDRESS_HERE'; $text = trim($_POST["article_text"]); $text = nl2br(wordwrap($text,60)); $message = '<html> <head> <title>'.$subject.'</title> </head> <body> <p> Hi,</p> <p></p> <b>First Name :</b>'.$_POST["firstname"].'<br> <b>Last Name :</b>'.$_POST["lastname"].'<br> <b>E-mail :</b>'.$_POST["email"].'<br> <b>Date Submitted :</b> '.$adate.'</br> <p></p> Has submitted article : <b>'.$_POST["article_title"].'</b><br> <b>Author\'s Name : </b>'.$_POST["author_name"].'<br> <b>Text:</b><br>'.$text.'<br> <br> </body> </html>'; $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; /* additional headers */ mail($email, $subject, $message, $headers); echo 'All done<br>'; } ?> |
| ----------------- Get Your Backlinks indexed quicker at BackLinks2RSS Create Full Text Feeds from Partial RSS Feeds at FeedExpander.com. See the WarriorForum post about it here | |
| | |
| | #3 |
| Warrior Member War Room Member Join Date: Feb 2007 Location: New York , USA.
Posts: 8
Thanks: 0
Thanked 2 Times in 2 Posts
|
Thanks for the help.
|
| www.homebusinessresearch.com Home Business help and resources. | |
| | |
![]() |
|
| Tags |
| article, form |
| Thread Tools | |
| |
![]() |