You are here: Re: publish and save button question « All PHP « IT news, forums, messages
Re: publish and save button question

Posted by J.O. Aho on 12/19/06 08:34

the red dot wrote:

> im trying to build a page where the user can enter some details in a form
> and (on clicking submit/publish/etc) it is uploaded to a database and the
> words entered can then be seen via another page (like a blog) all well and
> good i can do that
>
> but,
> i also would like a 'save' button which would save the entry for later
> updating/publishing - and i am stuck as to how to make this button do
> this...

There are a few options, if I have understood your question right,

1. You can store the values to a cookie, but that data will only accessible
only if using the same browser next time (with the same browser user profile)
and no cookie cleaning been done between the times. I don't recommend this.

2. You create yet another table in your database, you store all the "saved"
values here, this way the data will always be accessible. I do recommend this
way. You can of course set in a clean function to this, if you store the save
time, then you can flush out all old data that is say older than 3 months (or
what you pick), this way the table won't get filled up with obsolete data.


To make this, you just add another Submit button (name it Save),

<input type="submit" value="Submit" name="submit">
<input type="submit" value="Save" name="save">

then on the script which you defined in the form action field, you then
check for which submit button has been used

if($_REQUEST['submit']=='Submit") {
/* Store the data into the database, this is live data */
} else if($_REQUEST['save']=='Save") {
/* Store data to the temp table */
} else {
/* We had a person who tried to miss use this script */
echo "Don't use this script for fun!!!";
}

More difficult than that it shouldn't be.

--

//Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация