FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Textbox Submit to email





Sparda
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?
Mosquito.Tyler
This Page will show you how to make a basic PHP email script.

This Page might help teach you how to make it more secure.

N'Joy
Sparda
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?
MrBlueSky
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.
Sparda
How do I point with a browser? Is it a link?

<a href="hello.php">Hello Link</a>
MrBlueSky
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)
Diablosblizz
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.
Sparda
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>
hexkid
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";
...
manum
try out this tutorial this will help

http://w3schools.com/php/php_secure_mail.asp
Related topics
[php scripts ] phpweather&email
[ java scripts ] email service
[SCRIPT] - Como crio um Submit sem usar Outlook
form submit
form to email service: 20 FRIH$
Need help with Members area/link adder
AJAX tutorial [2nd part now updated]
HTML Buttons to submit text to a url
HTML submit textbox functions etc.
Submit Form Enter
Page Based Email Issue
Earn up to 1000FRIH$ to submit my sites to free directories
*solved*
submit email to an email address
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.