Question:

Php help. please .? i need a code.?

by  |  earlier

0 LIKES UnLike

i have a .html document and i want it to post to the page with php and i need a code will someone give me a php code.

here is my .html code

<html>

<head>

<title>blah</title>

</head>

<body>

<body bgcolor="CCCCCC">

<iframe src="post.php" width="500" height="245" border="0" name="display" id="display">

</iframe>

<form action="post.php" method="post" target="display" onsubmit="window.location.reload()">

<table border="0" width="500" length="250">

<tr><td align="right">name:<td>

<input type="text" name="name" size="20" maxlength="20">

<tr><td align="right">comment:<td>

<textarea cols="50" rows="4" name="comment" size="30" maxlength="30" </textarea>

<tr><td><tr><td>

<tr><td><th colspan="2">

<input type="submit" value="submit">

<td></tr>

</table>

</body>

</html>

 Tags:

   Report

1 ANSWERS


  1. in PHP the $_POST super global contains all the posted data.  If your post.php looked like this it would output the name and comment that were posted, if there was nothing posted it would output &quot;No information has been posted yet.&quot; ::

    &lt;html&gt;

    &lt;head&gt;

    &lt;title&gt;Post&lt;/title&gt;

    &lt;/head&gt;

    &lt;body&gt;

    &lt;?php

    if ( isset( $_POST[&#039;name&#039;] ) ) {

    echo $_POST[&#039;name&#039;] . &#039;&lt;br&gt;&#039;;

    echo $_POST[&#039;comment&#039;] . &#039;&lt;br&gt;&#039;;

    } else {

    echo &#039;No information has been posted yet.&#039;;

    }

    ?&gt;

    &lt;/body&gt;

    &lt;/html&gt;

    Notice that you access each individual element of the form by the name attribute you supplied in the form.  So to get the data entered into the textarea named comment you use $_POST[&#039;comment&#039;]

    [edit] fixed some minor syntax errors, no guarantees there aren&#039;t more ;-)

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.
Unanswered Questions