Link to home
Start Free TrialLog in
Avatar of weikelbob
weikelbobFlag for United States of America

asked on

Adding reset button to an email form.

Hello,
Could you guys look over my script below and tell me how to add a 'reset' button to the following e-mail form. The Form is in Flash MX.

<?php
$first_name = $_POST['t1'];
$last_name = $_POST['t2'];
$email = $_POST['t3'];
$menu1 = $_POST['t4'];

$message = "First-name: $first_name\n";
$message .= "Last-name: $last_name\n";
$message .= "E-mail: $email\n";
$message .= "Message: $comments\n";

mail ("weikelbob@aol.com",$first_name,$message);
header("Location: http://jibzauctions.com/index.html");
exit;
?>
Avatar of sint4x
sint4x
Flag of Canada image

This is the current code to actually email the data, your 1 step a head of yourself. What you need to do is go to the page that sends the user to this one and add the following html by the submit button (preferably): <input name="Reset" type="reset" value="Reset Fields">

That will reset all the fields.

Hope this helps.
Avatar of weikelbob

ASKER

Working on it...
I keep getting an error when I hit 'submit':

Parse error: parse error, unexpected '<' in /home/content/j/b/c/jbcellular1/html/nonf/form.php on line 12

Do you think my server is incompatible with the tag we added? Here's the code with the input tag:


<?php
$first_name = $_POST['first_name'];
$last_name = $_POST['last_name'];
$email = $_POST['email'];
$menu1 = $_POST['comments'];

$message = "First-name: $first_name\n";
$message .= "Last-name: $last_name\n";
$message .= "E-mail: $email\n";
$message .= "Message: $comments\n";

<input name="Reset" type="reset" value="Reset Fields">

mail ("weikelbob@aol.com",$first_name,$message);
header("Location: http://jibzauctions.com/nonf/index.html");
exit;
?>
No, this is not the page to edit.

When you are at the form, filling out your email, look at your address bar to see what the name of that file is, then post the code here and I will help you edit it.

P.S. Remove that input line in that script ^^
Here's the form.  Let me know if you need more from that file.



<form style="margin:0;color:#438092;margin-left:17px;margin-top:21px" action="form.php" method="post">
                    First Name:<br>
                    <input name="first_name" type="text" id="first_name" style="width:234px;height:19px;font-size:11px;border-color:#C7C7C7;border-style:solid;border-width:1px;background-color:#F3F3F3;margin-top:2px;margin-bottom:6px">
                    <br>
                    Last Name:<br>
                    <input name="last_name" type="text" id="last_name" style="width:234px;height:19px;font-size:11px;border-color:#C7C7C7;border-style:solid;border-width:1px;background-color:#F3F3F3;margin-top:2px;margin-bottom:6px">
                    <br>
                    Email:<br>
                    <input name="email" type="text" id="email" style="width:234px;height:19px;font-size:11px;border-color:#C7C7C7;border-style:solid;border-width:1px;background-color:#F3F3F3;margin-top:2px;margin-bottom:6px">
                    <br>
                    Comments:
                    <textarea name="comments" cols="" rows="" id="comments" style="width:234px;height:155px;font-size:11px;border-color:#C7C7C7;border-style:solid;border-width:1px;background-color:#F3F3F3;margin-top:2px;margin-bottom:6px;overflow:auto"></textarea>
                    <br>
                    <div align="right" style=" padding-right:18px">
                      <input type="image" src="5-but_01.jpg" align="absmiddle" width="90" height="9" border="0">                    
                      <input type="image" onClick="this.Submit()" src="5-but_02.jpg" align="absmiddle" width="90" height="9" border="0">
                     

                              </div>
                </form>
<form style="margin:0;color:#438092;margin-left:17px;margin-top:21px" action="form.php" method="post">
                    First Name:<br>
                    <input name="first_name" type="text" id="first_name" style="width:234px;height:19px;font-size:11px;border-color:#C7C7C7;border-style:solid;border-width:1px;background-color:#F3F3F3;margin-top:2px;margin-bottom:6px">
                    <br>
                    Last Name:<br>
                    <input name="last_name" type="text" id="last_name" style="width:234px;height:19px;font-size:11px;border-color:#C7C7C7;border-style:solid;border-width:1px;background-color:#F3F3F3;margin-top:2px;margin-bottom:6px">
                    <br>
                    Email:<br>
                    <input name="email" type="text" id="email" style="width:234px;height:19px;font-size:11px;border-color:#C7C7C7;border-style:solid;border-width:1px;background-color:#F3F3F3;margin-top:2px;margin-bottom:6px">
                    <br>
                    Comments:
                    <textarea name="comments" cols="" rows="" id="comments" style="width:234px;height:155px;font-size:11px;border-color:#C7C7C7;border-style:solid;border-width:1px;background-color:#F3F3F3;margin-top:2px;margin-bottom:6px;overflow:auto"></textarea>
                    <br>
                    <div align="right" style=" padding-right:18px">
                      <input type="image" src="5-but_01.jpg" align="absmiddle" width="90" height="9" border="0">                    
                      <input type="image" onClick="this.Submit()" src="5-but_02.jpg" align="absmiddle" width="90" height="9" border="0">
                      <input name="Reset" type="reset" value="Reset Fields">
                     

                         </div>
                </form>
Still does not work. Here's the URL:

http://www.jibzauctions.com/nonf/index-5.html

Bob
I was messing with the files a little, i'll stop. Hope I didn't disturb what you were doing.

Bob
This is kind of urgent, could someone assist me with this?

Bob
ASKER CERTIFIED SOLUTION
Avatar of sint4x
sint4x
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

Thanks for the script. I cannot get it to work.

The URL to my customer's site is jibzauctions.com/nonf/

Also, here's the form.php that is in the same directory as this script that i named index-5.html.

<?php

$msg = "First Name: " . $_POST['first_name'] . "\n";
$msg = "Last Name: " . $_POST['last_name'] . "\n";
$msg .= "Email: " . $_POST['email'] . "\n";
$msg .= "Comments: " . $_POST['comments'] . "\n";

$recipient = "weikelbob@aol.com";
$subject = "A customer2";

if(mail($recipient, $subject, $msg))
      echo "mail sent !";
else
      echo "Error in sending mail!";

?>


I appreciate the help.
What is not working, the reset or the mailer?
The reset is not working. Both of the words "submit" and "reset" bring up 'mail sent'
 and they both send me a message ( with the subject being the last name instead of the first name as it should be"

Bob
I'm going to switch over to the cgi form mailer way since Godaddy doesn't recognize php very well.

So I'm closing this question.

Bob