How can I insert posted data into the database?

How do I create a form for a user to insert data into a MYSQL database?

  • I am looking to create a form in PHP or HTML that any user of my site can submit 4* different fields into a database just through a form similar to any other form on the internet, (form being contact, registration or whatever). The fields would be: *ID - Which is auto incrament so im not sure if that would be included? TITLE - To display on the search page DESCRIPTION - As above URL: Obviously to link to the page intself KEYWORDS - These are not visible when a keyword is searched but they are what identifiy a search result. I would greatly appreciate it if someone could either write the code or at least give me a good indication as to where I could find such code. Up until now I have went through hundreds of google search pages and found none. Thanks, Andrew

  • Answer:

    make an HTML <form> with the "action" pointing to your PHP script and the "method" being post <form action="myscript.php" method="post"> <!--a text box identified by "name"; this "identification" will come later--> <input id="title" name="title" type="text"/> <!--a "hidden" field, which can contain "maintenance" or other information--> <input type hidden id="stuff" name="stuff" value="This is stuff."/> <!--submit button, "value" is the text to display --> <input type="submit" name="send" value="Search or whatever this is for"/> </form> in your PHP script, the fields can be found using $_POST["identification"], such as $_POST["title"] to get the contents of the textbox above, or $_POST["stuff"] to get "This is stuff." more info on the <input> tag -----> http://www.w3schools.com/TAGS/tag_input.asp

Andrew at Yahoo! Answers Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.