I've been trying to create an 'invisable' form, where the visitor only needs to click a button to send me some information about the page he's on. Unfortunately, without any success Somehow, the message doesn't get sent. This is the code I came up with: <form method="post" action="MAILTO:[I]myemailaddress[/I]"> <div> <input type="hidden" name="info1" value="info1" /> <input type="hidden" name="info2" value="info2" /> </div> <p align="center"> <input type="submit" name="submit" value="submit" /> </p> </form> Code (markup): Can someone please help me out?
I don't think you can use mailto in that manner. You could use your form as is, submit it to a php page and use mail() to send it to yourself using php. If you do not have php there is usually some type of form mail script on the server.
This would work: <form action="mailto:you@yourdmainhere.com" method="post" enctype="text/plain" > FirstName:<input type="text" name="FirstName"> Email:<input type="text" name="Email"> <input type="submit" name="submit" value="Submit"> </form> Code (markup): But it is NOT advisable. Colbyt is correct, use a server-side solution and clean/format the user input before sending it.
Actually, it should look like this: (Note that I am adding a "script" page - this is the file that will process the form and send the email - to the action attribute.) <form action="form-processor.php" id="subscription-form" method="post"> <div class="fieldset"> <fieldset> <legend><span>Subscribe Via Email</span></legend> <label for="first-name">First Name:</label> <input id="first-name" name="first-name"size="25" type="text"><br> <label for="email">Email Address:</label> <input id="email" name="email" size="25" type="text"> </fieldset> <input class="submit" type="submit" value="Subscribe"> </div> </form> Code (markup): Note that the form is written using elements that structure and identify what the form components are. The DIV and SPAN are used to get around an IE and Firefox bug. Details can be found here (I don't like the "update" since it relies on sending code to IE only) - http://www.tyssendesign.com.au/articles/legends-of-style/ But as for the original poster's request, a server-side programming language IS required to pull this off (the programming language will gather the data about the page and the user, such as the current page, IP address, and other such information). lokielookies, what information are you trying to gather? (Bear in mind I'm not a server-side developer; but I can try to help nonetheless.)
Thanks for the tips I want to create a button on my 404 error page that -when clicked - sends the missing page url to my mailbox.
Easy Solution for you. I have integrated the form in this PHP page for you. This should work as a contact page. You can add / remove values as per your needs. mail.php <? //------------------------------------------------ // File: 'mail.php' You can have this anything... // Func: using mail(); //------------------------------------------------ $Subject = "PHP Test E-mail"; $toEmail = "your_email@here.extn"; if(submit) { mail($fromEmail, $Subject, $nMessage."\nFrom: ".$fromName."<".$fromEmail.">"); } ?> <html> <head> <title>Mail Sender</title> <!--- You can change the Title above to something else of your choice ---> </head> <body bgcolor="#FFFFFF"> <form method="post" action="<? echo($PHP_SELF) ?>"> Your E-mail: <input type="text" name="fromEmail" size="25"> Your Name: <input type="text" name="fromName" size="25"> Your Message: <textarea cols="50" rows="5" name="Test Message to check VPS"></textarea> <br> <input type="submit" name="Submit" /> </form> Code (markup):
Actually, if it's a 404 page, just write a PHP script that acts as a custom 404 page that will automatically email you whenever it's "returned".
That's what I have now. I just want to replace the automated report feature and have the page only sent to me when a button is clicked.