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:
Dani AI
Short, practical follow‑up to the answers above (especially ) and a few fixes for the error reports from .
You can absolutely create the script in Dreamweaver, save it as a .php file and upload it (cPanel File Manager or FTP) into your web root (usually public_html). PHP runs on the server — testing by opening the file locally won’t execute PHP. Make sure each form control has a name attribute and the form’s action points to the script’s URL/path on the server.
Quick checklist for why a script “doesn’t work”
- File uploaded to the correct folder and named with
.php. - PHP tags present (
<?php ... ?>) and file saved without BOM (UTF‑8 without BOM). - Form fields actually send values (each has
name="..."). - Correct relative/absolute action URL.
- Permissions allow the webserver to write files if you want to save CSVs (use 0644/0664, avoid 0777).
- If nothing receives, enable temporary debugging:
ini_set('display_errors',1); error_reporting(E_ALL);or writevar_export($_POST, true)to a debug file to verify data arrival.
Security and mail notes
- Many hosts restrict or configure
mail()— if mail fails, either check host mail logs in cPanel or use an authenticated SMTP solution (e.g., PHPMailer). - Always sanitize header fields to prevent header injection. Example sanitizer:
<?php
function sanitize_header($s){
return str_replace(array("\r","\n"), '', trim($s));
}
?> Saving results for Excel
- Easiest is writing a CSV that Excel can open. Use fputcsv or build a line and append with an exclusive lock:
<?php
$row = ['name'=>$_POST['name'] ?? '', 'email'=>$_POST['email'] ?? ''];
$csv = '"'.implode('","', array_map('str_replace', array_fill(0,2,'"','"'), $row))."\"\n";
file_put_contents(__DIR__.'/submissions.csv', $csv, FILE_APPEND | LOCK_EX);
?> If you still see errors, post the exact PHP error message or copy the script here (don’t include live email addresses) and someone will point to the exact line.
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.
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
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.