HTML Expert Needed Badly

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

CoopGamer3

Thread Starter
Joined
May 30, 2004
Messages
24
Hi & Happy New Year.
I am stuck. I have created a form in Dreamweaver (which I would prefer not because if I get it right, I will need to buy it & $400 is rediculous). Anyway, I have everything the way I need it for the most part except my submit button. I want the submit button to send the information filled out to one of my email addresses & simultaneously redirect the user to another page in my site. I don't really know HTML but am forced to use it here. Not only do I not know what code to use, but I also don't know where to place it. Below is a snippet of the code view from my Dreamweaver form page if that helps.

<br />
<br />
Please see our FAQ pages for other options and questions.<br />
<br />
<input type="submit" name="Submit" value="Submit" />
</div>
</label>

Any help would be greatly appreciated. The only reason I am having all these problems is because I have been told to dump my already created forms in FrontPage (which was easy for me to create) & switch to something else. I could get NVU nor could I get any help with it. I have many other forms to create, none with the urgency of this one. So, once I am done with this one, I will go through a complete HTML tutorial but I can't (due to time constraints) right now.
Again, Thanks in advance
 

CoopGamer3

Thread Starter
Joined
May 30, 2004
Messages
24
I am still lost. I don't understand that page. I also reread (I read it before I posted) the other link. I am over my head & need to understand. The form I have is already created, I just need code for the button to send the results to my email & simultaneously redirect the user to another page. I am sorry I am not understanding. Can you post code or break it down simpler for me?
Thanks
 
Joined
Dec 22, 2004
Messages
721
Those links are good but it seems that you may need something simpler for the time being.

If you put the following code into the beginning of your form, it will email you(remembering to add your email address)

<form action="MAILTO:[email protected]" method="post" enctype="text/plain">

To the best of my knowledge, you cannot redirect to another page with html.

You will have to put a link button in or use javascript.
 

CoopGamer3

Thread Starter
Joined
May 30, 2004
Messages
24
Ok. I thought Javascript was HTML. I think I have an option to use Javascript in Dreamwevaer but again don't know how to impliment it. If I use what you said & then just add a link that they have to click on is better than nothing for now. Problem is, I don't know what you mean by "put the code in the beginning of your form". I am sure you don't mean make it the first thing that you see in the code view. I can't stress enough that I am barely understanding this stuff.
Thanks again
 
Joined
Dec 22, 2004
Messages
721
Here is a simple form that gives you an idea of what I mean

Code:
<table border="2" cellspacing="0" width="339" bordercolor="#C0C0C0" bgcolor="#C0C0C0" bordercolorlight="#C0C0C0" bordercolordark="#808080" align="left">
	<form action="MAILTO:[email protected]" method="post" enctype="text/plain">
    <tr>
      <td bordercolordark="#C0C0C0" valign="middle" align="center" width="329">
        <p align="center">We would like to hear your comments.</p>
    </tr>
    <tr>
      <td width="329" bordercolordark="#C0C0C0"><span >Name:</span><br>
        <input type="text" name="name" size="40"><br>
        <span>Email:</span><br>
        <input type="text" name="email" size="40"><br>
        <span>Phone:(optional)</span><br>
        <input type="text" name="phone" size="40"><br>
        <span>Comment:</span><br>
        <textarea type="text" name="comment" size="80" rows="2" cols="34"></textarea><br>
        <br>
        <input type="submit" value="Send">&nbsp;&nbsp;&nbsp;&nbsp; <input type="reset" value="Reset">
    </tr>
  </table>
You can see that when you first tell the browser that this is a form, you also tell it where the results of that form are to go when the submit button is pressed.

Hope that helps.

Just got your pm signal. Will post this and then have a look at it.

Just copy and paste the code into the body of your page and you should see a form.

Deep.
 

CoopGamer3

Thread Starter
Joined
May 30, 2004
Messages
24
I posted it in a new blank form & got it to appear when I tested in in the browser. So far so good. When I click send, I get a message & when I click "OK" instead of sending that stuff to an email, a blank email withe the address pops up. I want to be able to hit send & the information typed in just goes. As a bonus if possible to also simultaneously redirect the user to another page.
 
Joined
Aug 7, 2005
Messages
2,183
CoopGamer3 said:
I don't understand what you mean by:
"form sender/sent page"
OK, hold on... I'm writing up some stuff to explain it... (y)
~~~~~~~~~~~~~~~~~~~~

Alright... In order to send an email to someone and redirect them to a page, there are two pages involved. The first is the page with the form. Let's call this form.html. The second is the page that sends the email and redirects the user. Let's call this mailer.php.

Notice the .php extension. This is because in order to use PHP code, we need to have an extension of .php. PHP is just like HTML with some extra features. Assuming that you have a Linux server (not MS), you could put some HTML code in a .php file and it would work just fine.

The page with the form is just the form HTML code. You can put the form HTML anywhere you want in the page. Only a couple things matter here:
  • The "action" attribute of the form...
  • And the field names.

Let's pretend this is your form:

HTML:
<form method="POST" action="FILENAME.php">  
	<p><b>Submit your comments!<br></b>  
	Your name: <input type="text" name="yourname" size="20"> <br>  
	Comments: <textarea name="comments"></textarea><br>  
	<input type="submit" value="Submit"></p> 
</form>
It looks very ugly at the moment, but that doesn't matter. What matters is the field names and, like I said before, the "action" attribute of the <form> tag. In this case, it's action="FILENAME.php" Now, we would replace FILENAME with mailer, so that it reads action="mailer.php"

Note the names of our two fields, too. We've got yourname and comments.

Now, on to the PHP script...


I've inserted comments to explain what the script is doing. The stuff below would be the contents of our mailer.php file.

Code:
<?php
// Collecting the data from the form...
$comments = $_POST['comments'];
$yourname = $_POST['yourname'];

// Assigning variables...
$mailfrom = "[email protected]";
$subject = "SUBJECT HERE";
$redirectto = "PAGE TO REDIRECT TO";

// Writing the email message...
$msg = "<b>Name:</b> $yourname<br><b>Comments:</b>$comments";

// Doing some technical email stuff (Don't mess with this)...
$headers = "From: $mailfrom\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";

// Send the email!
mail( $mailto, $subject, $msg, $headers );

// Redirect the page
header( "Location:$redirectto" );
?>
There are three things that you need to replace in the script above.
  1. YOURSITE should be replaced with your site address...
  2. SUBJECT should be replaced with the subject of the email to be sent...
  3. And... PAGE TO REDIRECT TO should be replaced with the address of the redirect page.
Now, all you have to do is upload mailer.php and put the form HTML into the page you want it on.

Look good? Please post again if you're having problems. :cool:
 
Joined
Aug 7, 2005
Messages
2,183
Also note I can customize the code above if you want to give me the full HTML of the form so that it works exactly the way you want it. :)
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Top