Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

Ad sql record but include data from previous recor

Posted 19 Jan 2005 02:16:22
1
has voted
19 Jan 2005 02:16:22 Richard Irvine posted:
I hope this makes sense. I have a very simple php/mysql form where volunteers for our organisation can submit their hours for the month. (The volunteers visit isolated clients) It only contains fields for volunteer name, client initials, month and hours.

The vast majority of volunteers only visit one client so this is quite adequate, however sometimes they visit 2 or 3 and occassionally they may need to submit more than one month.

The form works fine, but the page I would like to go to after submitting is another form where they can submit hours for another month or another client. All that works fine too, except they have to type in their name on each form. I would like to have their name already displayed on the 2nd and subsequent forms, and that is the problem.

How can I have the name already displayed. The site will not be used that heavily so I figure I could just get the the last record added using the MAX() sql function but am having no luck getting it to work.

Any and all ideas greatly appreciated.

Replies

Replied 19 Jan 2005 02:37:23
19 Jan 2005 02:37:23 Chris Charlton replied:
SESSION variables would be my suggestion.

Edited by - ccharlton on 19 Jan 2005 02:37:57
Replied 19 Jan 2005 02:59:12
19 Jan 2005 02:59:12 Richard Irvine replied:
Just quickly read the help files in Dreamweaver and this is certainly the way to go. Unfortunately, all the examples refer to everythinh except php. Do I need to add a line somewhere in the code to define the variable?
Replied 19 Jan 2005 03:28:19
19 Jan 2005 03:28:19 Chris Charlton replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>(SESSIONS)...Just quickly read the help files in Dreamweaver and this is certainly the way to go. Unfortunately, all the examples refer to everythinh except php. Do I need to add a line somewhere in the code to define the variable?<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
I think you should read up first, here's the PHP manual page for <i>Sessions</i> (us2.php.net/session) as a starting point.

Also, you might want to consider reading <i>at least one</i> of these DMXzone premium articles on PHP/MySQL:
<ul><li><b>PHP Basics - Part 8: Cookies and Sessions</b> - www.dmxzone.com/go?6656</li><li><b>Working with Session Variables in PHP</b> - www.dmxzone.com/go?5454</li>
and if you are new to forms, maybe...<li><b>PHP Basics - Part 5: Forms, GET and POST</b> - www.dmxzone.com/go?6617</li></ul>

And for reference, here's a posting of most (not all) PHP/MySQL articles here on DMXzone: www.dmxzone.com/showDetail.asp?TypeId=28&NewsId=6970

Reply to this topic