Thursday, 23 August 2012

PHP Code for Comment box



First of all open a nodepad and save it "comment.php" and paste bellow code in it.

<html>
<head>
<title>Simple HTML form</title>
</head>
<body>
<form action="handle_form.php" method="post">
<fieldset><legend>Welcome</legend>
<p><b>Comments:</b> <textarea name="comments" rows"6" cols="80"></textarea></p>
</fieldset>
<div align="left"><input type="Submit" name="submit" value="submit my information"/><input name="reset" type="reset" value="Reset Fields" /></div>
</form>

</body>
</html>


Now open another nodepad file and save it with this name "handle_form.php" and paste bellow code in it.

<html>
<head>
<title>Form Feedback</title>
</head>
<body>
<?php # script 2.2 - handle_form.php
$comments = $_POST['comments'];

echo "<p>Thank you,</p>
<tt>Comments:</tt></p>
<p>$comments</tt></p>";

?>

1 comments:

  1. RIZE is known for its web development services world-wide andhttp://www.rizecorp.com/hirephpdeveloper.html
    is powerful area of ours. Basically designed for the creation of dynamic web pages and thereby website development.

    ReplyDelete