Example Form CSS Layout

Send to::
Name:
Email:
Overall Rating: [ Good]   [ Bad]   [ Ugly]

Comments


Form Box Layout Generator

Code for makeform.php page

<html>
<head>
<title>
Bookmark Title Here </title>
<style type="text/css">
.box { margin-top: px; margin-bottom: px; margin-left: px; width: px; padding: px; background-color: ; color: ; }

form { border: px solid ; padding: px; background-color: ; }

input { background-color: ; color: ; }

select { background-color: ; color: ; }

input.radio { background-color: ; }

textarea { background-color: ; color: ; }

.button { font-size: px; font-family: ; background-color: ; color: ; }

</style>
</head>
<body>
<div class="box">
<form action="formout.php" method="post">
<h2 align="center">
Example Form CSS Layout</h2>
<p align="center">
Send to:: <select name="attn" size="1">
<option value=" General ">
General </option>
<option value=" Owner ">
Owner </option>
<option value=" Technical Support ">
Technical Support</option>
<option value=" PHP Codemaster ">
PHP Codemaster</option>
</select>
<br />
Name: <input type="text" name="nameis" size="20" value="" />
<br/>
Email:<input type="text" name="visitormail" size="20" value="" />
<br/>
Overall Rating: [<input class="radio" checked="checked" name="rating" type="radio" value="good" />
Good]   [<input class="radio" name="rating" type="radio" value="bad" />
Bad]   [<input class="radio" name="rating" type="radio" value="ugly" />
Ugly] </p>
<h3 align="center">
Comments</h3>
<p align="center">
<textarea name="feedback" rows="6" cols="20">
</textarea>
<br/>
<input type="hidden" name="httpref2" value="" />
<input class="button" type="submit" value="Submit Button" />
</p>
</form>
<a href="http://www.maketemplate.com/form/">
Form Box Layout Generator</a>
</div>
</body>
</html>

(VIP: This PHP form processing script requires a web host that allows php scripts with safe mode off. See the feedback form tutorial for additional info on php forms. If your host does not allow php it will be necessary to use the old fashion 'action' to send results to your email - ugly :)

Code for 'formout.php'

PHP Form Processing Code
(and Thank You Page)


<h3 align="center">Thanks for your Feedback </h3>

<?php

$attn = $_POST['attn'];
$nameis = $_POST['nameis'];
$visitormail = $_POST['visitormail'];
$rating = $_POST['rating'];
$feedback = $_POST['feedback'];
$httpref2 = $_POST['httpref2'];
$attn = $_POST['attn'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];

$ip = getenv("REMOTE_ADDR");

if (eregi('http:', $feedback)) {
die ("Do NOT try that! ! ");


$todayis = date("l, F j, Y, g:i a") ;
$subject = "For " . $attn ;

$feedback = stripcslashes($feedback);

$message = " $todayis [EST] \n
Attention: $attn (Rating: $rating) (Form Page) \n
From: $nameis ($visitormail)\n
Feedback: $feedback \n
Additional Info : IP = $ip \n
";

$from = "From: YourFromEmail\r\n";
mail("YourRealEmail", $subject, $message, $from);

$screenout = str_replace("\n", "<br/>", $message);

?>

<p align="center">
<?php echo $screenout ?>
</p>


End of Copy n Paste Code!

VIP: Note this formout.php code uses only part of the code from the Feedback Form Generator (which also collects browser info, referral, etc - - visitor information to help webmasters track input). In other words, to learn how to 'parse' the output with a few extra features - refer to the Feedback Form Generator.
BTW: use submit in the form to see the results of the formout.php code.