Jump to content
dinesh101

How to create form in webbsite to collect message from visitor

Recommended Posts

I want to include a form in my website for visitors to enter there name, email and message. I have yet not learnt how to do it so i am looking for help...If sending form data to an email is too complicated, I dont mind having a system in which the form data is written on to a file in my server directory. Eg: a note which i can read manully.

Share this post


Link to post
Share on other sites

This will get you started http://www.w3schools...hp/php_mail.asp It's pretty easy, but let us know if you need help. Please notice that the link is for a php function. I suggest the php/sql route before trying to add javascript top the mix.

Edited by niche

Share this post


Link to post
Share on other sites

Your form needs an action attribute of a specified file which will deal with the submitted data.

 <form action="some_file.php" method="POST">   <fieldset>   <legend>Comment Form</legend>      <p><label for="name">Name:</label><input type="text" id="name" name="name" /></p>      <p><label for="email">Email:</label><input type="text" id="email" name="email" /></p>      <p><label for="comment">Comment:</label><textarea name="comment" rows="5" cols="30"></textarea></p>      <p><input type="submit" name="submit" value="Send Comment" /><input type="reset" name="reset" value="Clear" /></p>   </fieldset></form>

PHP script:

$name = $_POST['name'];$email = $_POST['email'];$comment = $_POST['comment'];

etc. There is more validation to be done before sending the email. Give niche's link a read. Regards, Labtec.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...