Variable Persistance
Posted: Tue Jan 27, 2009 3:23 am
I'm trying to write a CMS. I have a drop down box with the names of all the different pages the user could edit. If they choose one and hit submit an edit box appears preloaded with the current content for that page. The user should be able to edit it and hit submit to update.
My problem is that since they're not selecting the page and submitting the content in the same action by the time they go to update the content the script has forgotten what page they wanted to edit.
I tried this:
but it seems to forget $title by the time the content is submitted.
I could have them select the page and input the content in one fell swoop, but then it won't pull in the existing data, which would be annoying if you only wanted to change the content instead of replacing it.
Any help would be greatly appreciated. I need this to work tonight so I can do the design side of things tomorrow.
ps Sorry if this is obvious, it's very late here and I've been working on this project all day.
My problem is that since they're not selecting the page and submitting the content in the same action by the time they go to update the content the script has forgotten what page they wanted to edit.
I tried this:
Code: Select all
if (isset($_GET["title"])) {
$title = mysql_real_escape_string($_GET["title"]);
}
I could have them select the page and input the content in one fell swoop, but then it won't pull in the existing data, which would be annoying if you only wanted to change the content instead of replacing it.
Any help would be greatly appreciated. I need this to work tonight so I can do the design side of things tomorrow.
ps Sorry if this is obvious, it's very late here and I've been working on this project all day.