Hi, I was wondering how I could create some area of the page for the user to enter their text and submit it to be sent to my email. Does anyone have any idea how I could do this? If this would require php could you link me to something that could help me with php on frihost?
Textbox Submit to email
I have no experience with php and I try to learn it, but don't really understand it. I tried making a .php file from notepad and uploading to my site folder. I'm guessing I need a code on a htm page to call for the php to work am I right? That w3schools php tutorial doesn't seem to help me because when I try it, it doesn't work. Could someone explain to me how I would use php using frihost, saying that it has php built-in?
| Sparda wrote: |
| I'm guessing I need a code on a htm page to call for the php to work am I right? |
No. You just point your browser to the php file.
For example, put this:
| Code: |
|
<?php echo "Hello, world"; ?> |
in a file called hello.php. Then upload the file and point your browser to http://yoursite.com/hello.php or something like that.
How do I point with a browser? Is it a link?
<a href="hello.php">Hello Link</a>
<a href="hello.php">Hello Link</a>
| Sparda wrote: |
| How do I point with a browser? Is it a link?
<a href="hello.php">Hello Link</a> |
No, you just type www.yourdomain.com/hello.php in the location-bar of your browser, just like any other interadress you want to go to.
(Off course, instead of using www.yourdomain.com you use the name of your own site)
http://www.frihost.com/forums/vt-61428.html
Check out that page, look for my script that I edited, it comes with the IP of the user that submitted the infomation. It is 100% functional, unless you don't have php installed on your server.
Enjoy.
Check out that page, look for my script that I edited, it comes with the IP of the user that submitted the infomation. It is 100% functional, unless you don't have php installed on your server.
Enjoy.
Ok, I get the browser pointing thing. I would like for the user to just email "me." I don't want them to email whoever they want. Could you Help me with changing this code to emailing sparda@spardaslayer.frih.net?
| Code: |
| <html>
<body> <body background="america-frame-1024.jpg"> <?php function spamcheck($field) { //eregi() performs a case insensitive regular expression match if(eregi("to:",$field) || eregi("cc:",$field)) { return TRUE; } else { return FALSE; } }//if "email" is filled out, send email if (isset($_REQUEST['email'])) { //check if the email address is invalid $mailcheck = spamcheck($_REQUEST['email']); if ($mailcheck==TRUE) { echo "Invalid input"; } else { //send email $email = $_REQUEST['email'] ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; mail("someone@example.com", "Subject: $subject", $message, "From: $email" ); echo "Thank you for using our mail form"; } } else //if "email" is not filled out, display the form { echo "<form method='post' action='mailform.php'> Email: <input name='email' type='text' /><br /> Subject: <input name='subject' type='text' /><br /> Message:<br /> <textarea name='message' rows='15' cols='40'> </textarea><br /> <input type='submit' /> </form>"; } ?></body> </html> |
| Sparda wrote: |
| Could you Help me with changing this code to emailing sparda@spardaslayer.frih.net? |
I didn't look at the rest of the script ...
Just change the address in the mail() call
| Code: |
| ...
//send email $email = $_REQUEST['email'] ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; //mail("someone@example.com", "Subject: $subject", $message, "From: $email" ); mail("sparda@spardaslayer.frih.net", "Subject: $subject", $message, "From: $email" ); echo "Thank you for using our mail form"; ... |
try out this tutorial this will help
http://w3schools.com/php/php_secure_mail.asp
http://w3schools.com/php/php_secure_mail.asp
