• Advertisement
Sign in to follow this  

[web] Editing a blog post

This topic is 4260 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ive written a little blogging script in PHP & MySql thats been running away quite happily until I decided to improve it. I basically want to add additional functionality, such as the ability to edit and delete entries. And this is what is causing me the problem. As it stands, all of my entries are laid on on a standard html page. What im looking to achieve is to have an 'edit' button at the corner of each entry, and when its clicked, the original text is loaded into a form for me to ammend and resubmit. I know how to load the text into a form and resubmit it. But what I cant seem to figure out is how to identify which entry I want to edit. I know that I need to search for a specific value of the primary key(entryID) and edit that row, but I dont know how to return that value automatically once the 'edit' button has been clicked. I thought that I would need to assign the entryID to a variable, which will be called when the edit button is hit, but I dont know how identify the entryID in the first place without having to create a search script.

Share this post


Link to post
Share on other sites
Advertisement
If I understand you correctly, what you need is a hidden form value.

Just add this to your HTML form that's dynamically generated in response to the user asking to edit a post:
<input type="hidden" name="entryid" value="[the entry's ID]">

Then, when the form is submitted, this entry ID is received in the script just like any other form field.

Hidden fields

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement