| | |
HELP: created dreamweaver form, but how do i get results from form?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Nov 2005
Posts: 2
Reputation:
Solved Threads: 0
up to 3am last night, any help appreciated!!! have a html form created in dreamweaver. want users to complete their details on a form. do not need a dynamic page or sql d.base as only one way traffic. i just want to receive date in either email or excel format. my hoster works with cgi and php, but not asp. have read php is better, but do i need to creat a php script and do i create it in dreamweaver or do i create it thru the cpanel of my web hoster... really confused, know that i need to create this 'interpreter' prob using php, but don't know where its sits. could i cut and paste a php script and save as a .php in dreamweaver, if so how will this send the data, name-value pairs to my web hoster email or a specifiec excel d.base. wot do i type in my ACTION box!!!!! answers on a postcard please.......... thank u xxxxxxxx
•
•
Join Date: Jul 2005
Posts: 9
Reputation:
Solved Threads: 0
This should be fairly easy for you to do. We'll use a two page method as that's pretty easy to do.
1. Point your form at your soon to be created php script. You should have some like below in your form, method and action are the important part right now.
e.g. [PHP]<form name="register" method="post" action="process.php">[/PHP]
2. Create a page called process.php
note: if you see something like <words> change everything including the brackets.
[PHP]<?php
// this sets up your email headers, just change the email address
$headers = "From: "<youremailaddress@yourdomain.com>\r\n" .
'X-Mailer: PHP/' . phpversion() . "\r\n" .
"MIME-Version: 1.0\r\n" .
"Content-Type: text/html; charset=utf-8\r\n" .
"Content-Transfer-Encoding: 8bit\r\n\r\n";
// this emails you the results of the form
mail( "<youremail@yourdomain.com>", "<subject>", print_r( $_POST, true),"$headers">
// this will redriect the user somewhere away from this page
header("location: http://<whereyouwanttheusertobedirected>");
?>[/PHP]
So above it would print out something like:
Ugly but gets the job done. Once you get the above working you could try formating the message differently:
[PHP]
$message = "
Name: ".$_POST[name]."<br />
Email: ".$_POST[email]."<br />";
[/PHP]
Then you would replace the the print_r( $_POST ) with $message in your mail() command, like below
[PHP]mail( "<youremail@yourdomain.com>", "<subject>", $message ,"$headers">[/PHP]
Now it would print out like:
You could get even more completed by adding html commands to format text, add tables, whatever your imagination comes up with.
Have fun!
Mark
1. Point your form at your soon to be created php script. You should have some like below in your form, method and action are the important part right now.
e.g. [PHP]<form name="register" method="post" action="process.php">[/PHP]
2. Create a page called process.php
note: if you see something like <words> change everything including the brackets.
[PHP]<?php
// this sets up your email headers, just change the email address
$headers = "From: "<youremailaddress@yourdomain.com>\r\n" .
'X-Mailer: PHP/' . phpversion() . "\r\n" .
"MIME-Version: 1.0\r\n" .
"Content-Type: text/html; charset=utf-8\r\n" .
"Content-Transfer-Encoding: 8bit\r\n\r\n";
// this emails you the results of the form
mail( "<youremail@yourdomain.com>", "<subject>", print_r( $_POST, true),"$headers">
// this will redriect the user somewhere away from this page
header("location: http://<whereyouwanttheusertobedirected>");
?>[/PHP]
So above it would print out something like:
PHP Syntax (Toggle Plain Text)
Array ( [name] => Mark [email] => mark@email.com [buttons] => Array ( [submit] => Submit ) )
Ugly but gets the job done. Once you get the above working you could try formating the message differently:
[PHP]
$message = "
Name: ".$_POST[name]."<br />
Email: ".$_POST[email]."<br />";
[/PHP]
Then you would replace the the print_r( $_POST ) with $message in your mail() command, like below
[PHP]mail( "<youremail@yourdomain.com>", "<subject>", $message ,"$headers">[/PHP]
Now it would print out like:
PHP Syntax (Toggle Plain Text)
Name: Mark Email: mark@email.com
You could get even more completed by adding html commands to format text, add tables, whatever your imagination comes up with.
Have fun!
Mark
•
•
Join Date: Oct 2006
Posts: 1
Reputation:
Solved Threads: 0
i tried to use this scrpit and i resulted in error.please i would like to kno any correction that can be made in my code. the form page is www.freshrus.com/form.html
then i tried to make the
www.freshrus.com/process.php
if u can read the code and help me out it would be greatly spprcisted
then i tried to make the
www.freshrus.com/process.php
if u can read the code and help me out it would be greatly spprcisted
![]() |
Similar Threads
- Setting up a form in PHP (PHP)
- form-to-email in Dreamweaver (Community Introductions)
- creating Contact form to email and txt file (PHP)
- SQL access via Dreamweaver 2004 MX (MS SQL)
Other Threads in the PHP Forum
- Previous Thread: I am new to PHP and need some help
- Next Thread: need to make a link
| Thread Tools | Search this Thread |
apache api array basic beginner binary body broken cakephp class cms code computing confirm cron curl customizableitems database date date/time delete display dynamic echo email error file files filter folder form forms forum function functions gc_maxlifetime global google headmethod href htaccess html iframe image include ip javascript joomla limit link list login malfunction memmory memory menu mlm msqli_multi_query multiple mycodeisbad mysql navigation oop parameter parsing paypal pdf php phpmysql query question random recourse recursion regex script search select seo server sessions snippet source space sql static system table thesishelp trouble tutorial update upload url variable video web webdesign xml youtube





