Current location: Hot Scripts Forums » Programming Languages » PHP » place a count on a form


place a count on a form

Reply
  #1 (permalink)  
Old 07-12-05, 02:24 AM
buzzby buzzby is offline
Newbie Coder
 
Join Date: Apr 2004
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
place a count on a form

i need to place a count on a form in this way. when the users start to fill the form in they see this notice: "There are 20 places on this module" when the user submits the count needs to go down by 1 so when the next user fills in the form they see this notice "There are 19 places on this module" and so on till it gets to 1. the condition is that the number of places needs to be >=1. if its <1 then a notice needs to be shown "There are no more places" at this instant the database does not keep the data or allow ppl to enter the data. maybe the actual form just wont display.

how can i go about this
Reply With Quote
  #2 (permalink)  
Old 07-12-05, 03:24 AM
the_mole001's Avatar
the_mole001 the_mole001 is offline
Newbie Coder
 
Join Date: Feb 2004
Location: Australia
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
Hello there,

In your database i would assume that each module has a name, for example 'hugo'. When checking for places available this is what i would suggest.

Have a field, hidden or otherwise, with the value of the module being joined, which i will name 'modname'. The same name i will use in the database.
PHP Code:

//database connecting here

if(isset($_POST['modname'])){
if(
mysql_num_rows("SELECT * FROM modules WHERE modname='".$_POST['modname']."'") <= 20){
//do the code that will let them join the module
} else {
//do the code to show the error saying the module is full
}

I hope this code makes sence and helps.
__________________
Current Project: GGAC Website
Project Link: http://peter.5gigs.com/

Last edited by the_mole001; 07-12-05 at 03:25 AM. Reason: error
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP upload prob minority ASP 1 06-27-05 08:35 AM
focus is lost once modal form is unloaded substance Visual Basic 0 01-31-05 08:29 PM
checkCheckboxGroup broken after form consolidation ski_woman JavaScript 0 01-12-05 11:00 AM
formmail problem gscraper Perl 12 08-27-04 03:06 AM
Limit the form submission according to time bionicsamir PHP 7 05-09-04 11:10 PM


All times are GMT -5. The time now is 06:55 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.