haynbrian
11-23-2003, 02:20 AM
Hello all.
I have a question. I'm creating a website that has mailing list and inquiry forms on it (each form on a separate page). My goal is to get the information to submit and after the action is taken the same page is showing, only cleared textboxes where the information was, and the information has been sent.
The only way I could think to do this was to make the entire page a PHP file called thisPHPfile.com. When the submit button is pushed, it sends the information to the appropriate e-mail address in the same thisPHPfile.php document. That is to say, the attribute in the form is [action="thisPHPfile.php].
My problem with this is everytime I visit the page, the information is sent to my e-mail address. It's not only sent when I press the submit button, but everytime the page refreshes.
Below is what the code would look like:
<?php
$message="Name: txt_name/n/n".
"E-mail: txt_email".$text;
mail("abc@email.com","$message");
echo"
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
</head>
<body>
body content, pictures etc.
<form name='form1' method='post' action='thisPHPfile.php'>
Name:
<input name='txt_name' type='text' id='txt_name'><br><br>
E-mail:
<input name='txt_email' type='text' id='txt_email'><br>
<br>
<input type='submit' value='submit' name='submit'>
</form>
<br>
<br>
more content and pictures below.
</body>
</html>"
?>
I had thought of embedding the php into the html code, but I'm not sure how to do that, or if that would even solve my problem. I'm not too good at PHP right now, I'm trying to get better, so I apologize in advance for any errors my code has.
Does anyone know what I might be able to do?
Thanks,
Brian
I have a question. I'm creating a website that has mailing list and inquiry forms on it (each form on a separate page). My goal is to get the information to submit and after the action is taken the same page is showing, only cleared textboxes where the information was, and the information has been sent.
The only way I could think to do this was to make the entire page a PHP file called thisPHPfile.com. When the submit button is pushed, it sends the information to the appropriate e-mail address in the same thisPHPfile.php document. That is to say, the attribute in the form is [action="thisPHPfile.php].
My problem with this is everytime I visit the page, the information is sent to my e-mail address. It's not only sent when I press the submit button, but everytime the page refreshes.
Below is what the code would look like:
<?php
$message="Name: txt_name/n/n".
"E-mail: txt_email".$text;
mail("abc@email.com","$message");
echo"
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>
</head>
<body>
body content, pictures etc.
<form name='form1' method='post' action='thisPHPfile.php'>
Name:
<input name='txt_name' type='text' id='txt_name'><br><br>
E-mail:
<input name='txt_email' type='text' id='txt_email'><br>
<br>
<input type='submit' value='submit' name='submit'>
</form>
<br>
<br>
more content and pictures below.
</body>
</html>"
?>
I had thought of embedding the php into the html code, but I'm not sure how to do that, or if that would even solve my problem. I'm not too good at PHP right now, I'm trying to get better, so I apologize in advance for any errors my code has.
Does anyone know what I might be able to do?
Thanks,
Brian