Question:
HTML form without a server?
RKS
2010-06-15 23:00:01 UTC
I'm making a website for a friend, but have never worked with a form or PHP. I added the code but when I try to test it, it goes to outlook. I understand that it won't work if the user doesn't have a server side, but how do you get it to work? Here is the code:



* indicates required information








Contact Information






















Type




Type (check all that apply)















If you have to use PHP, where can you get the code for the form. Also, how do you test it without loading it to a website?
Four answers:
2010-06-16 00:28:30 UTC
Use a server-side script language if your web site allows it. Otherwise, you will have to use a client-side dependent "mailto:" action to get the form info sent to you.



Your current hosting package MUST allow SMTP ( http://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol ) to work. Otherwise, no email can be sent.



Use any of the below sites to make the workable form you need:



For making forms:



These are really good online form makers. Just follow the instructions for making it and uploading file(s).



http://www.jotform.com/?gclid=CNKhqei1wJ4CFRQhnAod6laUqA (WYSIWYG Form Maker)

http://www.thesitewizard.com/wizards/feedbackform.shtml

Ajax - Creating an HTML Form: http://www.tizag.com/ajaxTutorial/ajaxform.php

http://www.phpform.org/

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



http://www.thepcmanwebsite.com/form_mail.shtml

http://emailmeform.com/

http://www.freecontactform.com/

http://www.reconn.us/content/view/12/34/ (Download - Contact Us Script)



Ron
2016-10-05 01:41:47 UTC
All cyber web hosting servers have *something*.. you could no longer do something with the form documents in case you do no longer use the server in *some way*.. you will desire to theoretically use AJAX and a txt XML report i assume.. yet may well be enourmous quantity of code in Javascript to do something Hypertext Preprocessor or asp might make uncomplicated. Yeah.. you will desire to pass lower back to the ice age and use CGI
?
2010-06-15 23:15:05 UTC
You do not need a server to test this form, HTML can easily be run in just any browser, locallly on your computer. The reason why this script is opening up outlook is because you have this







The action is "mailto:joe........" Mailto is a command used in HTML that by default when clicked opens up the default email client.



A more modern approach to setting up a contact script would be using AJAX or using a service like WUFOO
Chris C
2010-06-15 23:25:12 UTC
What it boils down to is changing the "action" portion of the web form.

action="mailto:joe.hablano@live.com"



To the PHP web page, like this (obviously you can call any PHP file that is on your website:

action="myemailform.php"



In all honesty, I often code this so that the form and the actual send are part of the same PHP page. Then you can do something like this in PHP:

action="$_SERVER['PHP_SELF']"



The form can then be entirely self-contained.



Here's an example of PHP code that can be used to send mail from your web site:




$MP = "/usr/sbin/sendmail -t";



if ($formFill && (! empty($recipient)) && $properlyFilled) {

   $fd = popen($MP,"w");

   fputs($fd, "To: $toEmail\n");

   fputs($fd, "From: $fullFromEmail>\n");

   fputs($fd, "Subject: Whatever subject you want for the email here!\n");

   fputs($fd, "X-Mailer: PHP\n");

   fputs($fd, "Content-Type: text/html; charset=us-ascii\n");

   fputs($fd, "Content-Transfer-Encoding: 7bit\n");

   fputs($fd, "\n");



   // Repeat creating the body of the email here, by using the same code as above,

   // creating an email that is HTML based. Example just below

   fputs($fd, "This message is from: $fName $lName
\nwhatever text you want goes in this location");



   fputs($fd, "\n");

   pclose($fd);

} else {?>

   


}

?>


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...