Hey all !

I am wondering if there is any way by which we can take an input from a user using a html form and write it to a file inside a specific div tag in a specific file.

for ex:

I enter a Name in a form

the name is sent to a page

the name is writted inside a div tag where the name should be displayed

Is there any way to do this?
If yes , a little hint of coding would be really helpful!

Thanks in advance!

6 Years
Discussion Span
Last Post by broj1

yes it's posible
do you want to refrech the page (press the submitbutton), or does the name div have to change while you type?


This is i.e enter_name.html with a form containing a text input element and a submit button

<form method="post" action="show_name.php">
<input type="text" name="entered_name" />
<input type="submit" name="submit" value="submit">

This is show_name.php that receives the post data and displays it; specific file is in the action of the form, specific div is below.

if(isset($_POST['entered_name'])) {

    echo '<div id="myname">';

    echo $_POST['entered_name'];

    echo '</div>';

This is basics, there is much more to it in practice (security, handling errors, some useful functionality etc)

Edited by broj1: typos, what else

This topic has been dead for over six months. 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.