0

Hello friends,
Will you please tell me, how can i display contents of the form on the same page of that form?
Thanks to all!

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by omol
0

Hello friends,
Will you please tell me, how can i display contents of the form on the same page of that form?
Thanks to all!

:?: not a clear question for me.
anyway, contents of a form may not display on the same page of that form if it has the " action = 'page2.php' " like this :

//on page1.php
<form method = 'post' action = 'page2.php'>
- sample contents -
</form>

you won't include the " action = 'page2.php' " if you want the contents of the form to be displayed just in the same page where you write the form like this :

//on page1.php
<form method = 'post'>
- sample contents -
</form>

please do correct me if i'm wrong in terms of understanding your concern. Ϋ

0

Do you want to post back to the current page?

<?php
if (!empty($_POST['submit'])) {

echo $_POST['box'];

} else {
?>

<form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
<input type="text" name="box" />
<input type="submit" value="Submit" name="submit" />
</form>

<?php
}
?>

If you want to post back to the same page, use the above method. If you want to continue displaying the form after the submit, remove the else statement.

Edited by omol: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.