-5

Guys i am a complete noob in PHP, and so i need help with my question. Here is my code:

<div class="form-group">
                  <input id="name" placeholder="test 123" value="" type="name" class="form-control">
                </div>

I would like the name field to be saved to a text file.

Pavam564
  • 1
  • 1

1 Answers1

0

You should specify the input name first.

    <div class="form-group">
<form method="post" action="filename.php">
                      <input id="name" placeholder="test 123" value="" name="name" type="name" class="form-control">
    </form>
                    </div>

Send the post data to the php page. And paste this code there

<?php
$name = $_POST['name'];
file_put_contents("file_name.txt",$name); // Will put the text to file
?>

Hope this helps you

Utkarsh Dixit
  • 4,267
  • 3
  • 15
  • 38