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 :confused:

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.

<form name="register" method="post" action="process.php">

2. Create a page called process.php

note: if you see something like <words> change everything including the brackets.

<?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>");

?>

So above it would print out something like:

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:

$message = "

Name: ".$_POST[name]."<br />
Email: ".$_POST[email]."<br />";

Then you would replace the the print_r( $_POST ) with $message in your mail() command, like below

mail( "<youremail@yourdomain.com>", "<subject>", $message ,"$headers">

Now it would print out like:

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

I noticed the this forum stipped out my backslashes, so wherever you see "rn" in the headers area there needs to be a backslash, eg. \r\n

gosh ur an angel..im going to try it right away... someone also mentioned executed php script so will explore too...thank u a million times... (big smiley face)

gosh ur an angel..im going to try it right away... someone also mentioned executed php script so will explore too...thank u a million times... (big smiley face)

NP ask if you have questions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.