0

I have this html file:

<div>
    <div class="input">
        <img src="2017-01-10.jpg">
    </div>
    <div class="input">
        Some text here
    </div>
    <div class="input">
       January 10th 2017
    </div>
</div>

I would like to make an input form (in another page) that add a div like that, above it.

So the user can fill the form with an image, a text and a date and when submit that will add to the html file above a code like that but with a new input.

In the end the code would be like this:

<div>
    <div class="input">
        <img src="2017-01-11.jpg">
    </div>
    <div class="input">
        Some text here
    </div>
    <div class="input">
       January 11th 2017
    </div>
</div>

<div>
    <div class="input">
        <img src="2017-01-10.jpg">
    </div>
    <div class="input">
        Some text here
    </div>
    <div class="input">
       January 10th 2017
    </div>
</div>

What would I put into the php file of the form? Is that possible for php to write permanently into the html file?

5
  • You can insert form data in database and call it in html page using while loop Commented Jan 10, 2017 at 10:35
  • The manual Is always the first place to start Commented Jan 10, 2017 at 10:54
  • "What would I put into the php file of the form?" — You need to start with an introductory PHP tutorial and not with Stackoverflow. (Well, you can start with the tag wiki and use it to find a suitable tutorial). Commented Jan 10, 2017 at 10:59
  • "Is that possible for php to write permanently into the html file?" — Possible, but a terrible idea. Use a database. Commented Jan 10, 2017 at 10:59
  • 1
    Thanks for the answers! I will try to learn some php and Mysql Commented Jan 10, 2017 at 11:06

1 Answer 1

1

You need to process the user input to an SQL database. The user input will then be stored in the .html file permanently. But you're not done there, you also have to add a .htaccess file to your site to parse PHP into HTML.

To learn how to save the user input from PHP to an SQL database watch this video. And to learn how to use .htaccess watch this video.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.