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!

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">
</form>
...

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)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.