View Full Version : JS help needed (Auction Site)

08-25-2010, 04:31 AM
I'm trying to create an online auction site, most of the pages are complete. I decided to start working on the functionality for the bidding page and did a rough sketch of what would be taking place on this page. Sadly I am a total newbie to JS and I have no idea how to accomplish what I wish to get done. Any help would be greatly appreciated.

Here's my logic thus far (this would all occur when a user clicks on the 'Bid' button' :

next_bid = current_bid + bid_increment

If bid_amt < next_bid
Error msg "Your bid MUST be greater than or equal to the next bid amount " + next_bid " ."

Else {
Msg "Are you sure you want to bid " + bid_amt " ?"
If selected = YES
If current_time > end_time
auct_status = Closed
Update tbl_auction {auction_status}
Msg "Sorry, this auction is closed."
current_bid = bid_amt
bid_time = current time
Insert into tbl_bid {bid_amt, bid_time, bid_date,

Update auction {current_bid}
Msg "Bid successful"
End If

End If
End If

NB. I am using Mysql for my database and my pages are all php.

Old Pedant
08-25-2010, 08:28 PM
Since very little of the code you show there *COULD* be in JavaScript, maybe you should (for starters) forget JS and just code in PHP. Later, when the PHP works, you could maybe enhance it with JS. But start with PHP.

You should also look around and see if you can't find pre-written code, rather than re-inventing the wheel. I don't use PHP, but I know there are *TONS* of available code in other server-side systems. Surely ditto in PHP.

08-28-2010, 01:11 AM
Good advice. I shall do it all in PHP then enhance with JS after. Thanks

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum