Jump to content

Update Mysql from text input (pdo)


htmlboss

Recommended Posts

Sorry if this sounds like a noob question ( smile.gif ), but how would I go about retrieving data POSTed from a text input field (sample below), update the respective row (WHERE id=1 for example) and then display the data in the same input fields again for ease of editing (all-the-while using PDO of course biggrin.gif )?

<form action="form.php" method="POST">
   <input type="text" name="header1" placeholder="Header text here">
   <textarea name="summary1" placeholder="Summary text here">
   <input type="submit" name="submit" value="Update Info">   
</form>
Link to comment
Share on other sites

this sounds like another current thread, where someone just posted what they want and expected someone to do everything for them, especially since the OP in this thread is copy/pasting this question on multiple help sites.

 

first of all, your question about how to do this task isn't a mysql database question. you may be using a mysql database, but until you have a sql query statement at all, you don't have a mysql database problem.

 

next, processing form data and retrieving and displaying database information is what php was created to do and there are 100's of thousands of examples posted on the web for you to find, examine, and learn the basics from.

 

in short - where exactly are you stuck at when you tried to do this? programming help forums are not here to find, give, or write code for you. without knowing what sort of problem you had when you tried this, the answer could range from a) you need to buy a good php/mysql book and/or take a programming class to z) you have a logic or syntax problem in your code that we could help with if you posted your code and told us what sort of error or symptom you got from that code.

Link to comment
Share on other sites

the other thread about retrieving data based on an input id, is just the first step in the U (update) part of a CRUD assignment. this thread seems to be asking about a part of the same U process, but skipped the first step of retrieving the existing data to populate the form fields. this looks more like the C (create) form was just dumped here without having any code to populate it with existing values.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.