HTML fill-in and submit form

Miscellaneous Forums/General Discussion/HTML fill-in and submit form

I want something like this. I assume it generates an email when it is sent? How do I make this?
http://www.sketchup.com/index.php?id=1915

In ASP.NET its easy...

Protected Sub btnSend_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSend.Click
        Dim Msg As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage()
        Dim MailObj As New System.Net.Mail.SmtpClient("smtp.mysite.co.uk")
        Msg.From = New System.Net.Mail.MailAddress("michael@mysite")
        Msg.To.Add(New System.Net.Mail.MailAddress("michael@mysite"))
        Msg.IsBodyHtml = "False"
        Msg.Body = tbxName.Text & " [" & tbxEmail.Text & "]" & Chr(13) & Chr(10) & tbxMessage.Text
        Msg.Subject = "Website Message"
        MailObj.Send(Msg)
End Sub


This is what I have in my contact page at my site, below. In php though, I wouldnt have a clue!

http://www.tele-pro.co.uk/scripts/contact_form/

If you wanted to do it in PHP you can use the built in Mail() function.

You need to configure the settings for Mail in php.ini - instructions here.

Quick example PHP/HTML code (should work but I haven't tested it). Sorry the form is ugly. I couldn't be arsed to format it properly.
<?php
	if (!$_POST['submit'])
		{
			?>		
			<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
				Address: <input type="text" name="address" size="50"><br>
				Subject: <input type="text" name="subject" size="50"><br>
				Message: <input type="text" name="message" size="50"><br>
				<input type="submit" name="submit" value="Send">
			</form>
			<?php
		} else {
			$addr = $_POST['address'];
			$subj = $_POST['subject'];
			$msg = $_POST['message'];
			$result = mail($addr, $subj, $msg);
			if ($result)
				{
					echo "Mail sent!";
				} else {
					echo "Unable to send!";
				}
		}
?>


[edit] Just tested it and it works fine.

Loves PHP, hates ASP

:)

Loves ASP.NET, don't know PHP

Way to go Tri|Ga|De!!!

Seriously though, its probably what works best for you... I use and enjoy a lot of MS's Visual tools, so Web Developer is a natural development setup for me!

That contact form generator doesn't work. The fields I entered don't havea control next to them, they are just text.

Does this help:-

http://www.thesitewizard.com/archive/feedbackphp.shtml

http://www.htmlbasix.com/forms.shtml

If you want to go through the html route, you would need to use formmail, there is a secure formail using perlscript which is quite safe. Check out: http://nms-cgi.sourceforge.net/

Easy to setup, but your server must support perlscript, which is really common anyway

THank you