Hi there…
I am currently working through my first attempt at php and i have hit a brick wall, i am trying to put together a form processing script. What i have so far i have put together through research but it is very basic. Although basic it works and sends the email i have told it to, but other than “htmlspecialchars” it has no security or validation.
Through research i can find code that is supposed to achieve what i want but it is given in snippets and with no guide as to where in the code it should go therefore leaving me confused. Also after submission it echo’s a lil message and a link back to a page on site but its not pretty and would prefer it to redirect to a prepared thankyou page which as yet i havent been able to accomplish either.
The code below is created in dreamweaver, any or all help will be greatly appreciated…
Form
[code]
Message
[/code]
Processing code
[php]<?php
$name = htmlspecialchars($_POST[‘name’]);
$email = htmlspecialchars ($_POST[‘email’]);
$number = htmlspecialchars ($_POST[‘number’]);
$topic = htmlspecialchars ($_POST[‘topic’]);
$message = htmlspecialchars ($_POST[‘message’]);
$formcontent = “From: $name \n Email: $email \n Number: $number \n Topic: $topic \n Message: $message”;
$recipient = “*******@hotmail.co.uk”;
$subject = “Contact Form”;
$mailheader = “From: $email \r\n”;
mail($recipient, $subject, $formcontent, $mailheader) or die(“Error!”);
echo “Thank You!” . " -" . " Return Home";
?>[/php]