Jump to content

Inserting PHP into a HTML Document


shadowcastpm

Recommended Posts

For example, you have a HTML form,

myform.html
[code]<html>
<head>
</head>
<body>
<form action="post.php" method="post">
<input type="text" name="mytextbox" value="hello~">
<input type="submit" name="submit" value="submit me">
</form>
</body>
</html>[/code]

post.php
[code]<?php
//-- see if the form is bring us to this page :)
if(isset($_POST["submit"]))
{
    echo htmlentities($_POST["mytextbox"]);
}
?>[/code]

Now, Depending on the method used POST or GET, in this case we used POST (<form action="post.php" method="post">)... So the results will be in the $_POST superglobal, else if we used GET, they'd be in the $_GET superglobal.

Hope that helps :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.