ben_1uk Posted February 26, 2013 Share Posted February 26, 2013 Hello everyone, I already have a thread regarding this topic featured within the 'Third Party Scripts' forum, but I think it may be better suited to this particular part of the forum given the nature of the enquiry. I have a ticket counter featured on a website I work on that displays the number of tickets left available for a number of events. I have since 'commented out' the code that displays the counter as it was decided by management that we no longer wanted people to see how many tickets had sold for any of the venues. However, I now need the script to work in such a way that the ticket counter does not shown until the number of tickets left reaches '40', ie, highlighting limited availability. The below code displays what I have so far and how the counter currently works, but I'm not sure how to modify the below in order to make the counter behave as required above. //echo "<div class='tickets'>" . ($v['tickets_left'] < 30 ? "<span class='tickets_low'>" . escape($v['tickets_left']) . "</span>" : "" . escape($v['tickets_left']) . "") . " tickets left to buy for this match</div>"; if ($v['tickets_left'] > 0) { echo " <div class='tickets_buy'> <input type='hidden' name='venue[]' value='" . escape($v['id']) . "' /> Select how many tickets you wish to buy <select name='quantity[]' id='venue_" . escape($venuecount) . "' onchange='update_tickets()' onkeyup='update_tickets()'> <option value='0'>No tickets</option> <option value='1'" . (isset($_SESSION['tickets'][$v['id']]) && $_SESSION['tickets'][$v['id']] == '1' ? " selected='selected'" : "") . ">1 ticket</option> " . ($v['tickets_left'] > 5 ? " <option value='2'" . (isset($_SESSION['tickets'][$v['id']]) && $_SESSION['tickets'][$v['id']] == '2' ? " selected='selected'" : "") . ">2 tickets</option> <option value='3'" . (isset($_SESSION['tickets'][$v['id']]) && $_SESSION['tickets'][$v['id']] == '3' ? " selected='selected'" : "") . ">3 tickets</option> <option value='4'" . (isset($_SESSION['tickets'][$v['id']]) && $_SESSION['tickets'][$v['id']] == '4' ? " selected='selected'" : "") . ">4 tickets</option> <option value='5'" . (isset($_SESSION['tickets'][$v['id']]) && $_SESSION['tickets'][$v['id']] == '5' ? " selected='selected'" : "") . ">5 tickets</option>" : "") . " </select> <a href='#buy'>Confirm Ticket</a> </div> "; If someone more knowledgeable than myself could help out I would be really grateful Many thanks in advance, Ben_1uk. Quote Link to comment https://forums.phpfreaks.com/topic/274964-ticket-counting-script/ Share on other sites More sharing options...
QuickOldCar Posted February 27, 2013 Share Posted February 27, 2013 if ($v['tickets_left'] >= 1 && $v['tickets_left'] <= 40) { Quote Link to comment https://forums.phpfreaks.com/topic/274964-ticket-counting-script/#findComment-1415264 Share on other sites More sharing options...
QuickOldCar Posted February 27, 2013 Share Posted February 27, 2013 also don't forget to add your curly brace at the end to wrap your if statement, I didn't see it in your posted code } Quote Link to comment https://forums.phpfreaks.com/topic/274964-ticket-counting-script/#findComment-1415266 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.