O'Reilly logo

PHP for Teens by Maneesh Sethi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding PHP

We have created a full form. Only one problem—if you open this web browser and press Submit Query, nothing happens! This is where PHP comes in. Before adding PHP, take a look at the source code for the web page we just created:

<html>
<head>
<title>A Sample Form</title>
</head>

<body>
<h1>A Sample Form</h1>
<br />
<form action="" method="post">
Name: <input type="text" name="fullname" />
Address: <input type="text" name="address" /><br /><br />
Comments: <textarea name="comments" cols="40" rows="2"></textarea><br /><br />
<input type="submit" name="submitbutton" />
<input type="reset" name="resetbutton" />

</form>
</body>
</html>

How does the form know to which page to send the data? It is defined in the action attribute of the <form> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required