Forum Moderators: phranque
<form action="http://www.mysite.com/test.php" method="post">Form content goes here</form>
I thought it might be because I was trying to test the HTML file on my local computer but thats not it, when I try on different website that I did it works fine... need help here guys.
Any help would be greatful,
Thanks
1) Do you have a form page and a separate form processing page? Is file.php the name of the page with the form on it, or is that a separate page which processes the contents of the form?
2) You say you're testing this on your home computer. Is the form file a .php file? If so, do you have PHP installed and working on your home computer? If not, this could prevent it from working correctly.
Here's how I go about making a contact form:
form.html --> this page contains the form where they enter their contact info & question/comment. The form has action='process_form.php' as its target.
process_form.php --> this page gets the POST data, mail()s the contact to me, outputs "Thank you for your question/comment/etc."
You could make a single .php page with an IF statement to determine whether to display the form or process the form, but I wouldn't recommend it.
the page the form goes on, lets say its called contact.htm
i just have a standalone php file called "form.php" for example
i just set the action to form.php ... i dont have the php file on my local system, i have it on my web server which does support php, but even if i do upload everything, it still just refreshes like it does on my local system. i am really lost on this one.
-------------
form.html (this is where they enter the contact info & question/comment)
<body>
<form name="contact_form" method="POST" action="form_processor.php">
<p>Enter your email address: <input type="text" name="email_address"></p>
<p>Enter your question/comment: <textarea name="question_comment" cols="20" rows="20"></textarea>
<p align="center"><input type="submit" value="Submit"></p>
</form>
</body>
---------------
form_processor.php (this receives all the data from the form and does what you want with it. In this case, it emails it to you)
<body>
<?php
$email_address=$_POST['email_address'];
$question_comment=$_POST['question_comment'];
$email_from="From: ".$email_address;
$email_subject="Contact form email";
mail("youremail@yourdomain.com", $email_subject, $question_comment, $email_address);
?>
<p>Thank you for your question/comment.</p>
</body>
------------
[edited by: roldar at 12:56 am (utc) on Jan. 20, 2005]