Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Help with drop down buttons
Old 04-04-2010, 03:07 PM Help with drop down buttons
millwalll's Avatar
Webmaster Talker

Posts: 674
Name: James
Location: KENT
Trades: 3
Hi all,

I am trying to do a drop down menu that passes the seleced value to some code and does a calculation with it. I can do this fine however the problem is when the page loads. it loads with error I think this is becaue no value is being passed but I cant think of way to fix this problem..

Notice: Undefined index: TicketNumber in C:\wamp\www\Tic.php on line 89

PHP Code:
  <form id="form" name="form" method="post" action="">
     <p>
       <label for="TicketNumber">Number of Tickets:</label>
       <select name="TicketNumber" onchange="this.form.submit()" id="TicketNumber">
       <option value="0">0</option>
         <option value="1">1</option>
         <option value="2">2</option>
         <option value="3">3</option>
         <option value="4">4</option>
         <option value="5">5</option>
       </select>
<label for='Title2'></label>
    <?php 
    
      $price 
30;
      
$total $_POST['TicketNumber'] * $price;
      echo 
"<P> The total cost of tickets will come to"." "."£"."$total</P>";
    
      
?>
     </p>
    </form>
Thanks in advance :P
__________________

Please login or register to view this content. Registration is FREE
millwalll is offline
Reply With Quote
View Public Profile Visit millwalll's homepage!
 
 
Register now for full access!
Old 04-04-2010, 04:50 PM Re: Help with drop down buttons
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
check the value exists, if it does run the code, if not. ... don't.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 04-04-2010, 05:15 PM Re: Help with drop down buttons
millwalll's Avatar
Webmaster Talker

Posts: 674
Name: James
Location: KENT
Trades: 3
Hi thanks Chrishirst, I got this sorted but I have another problem maybe you can help? becasue I am using the onchange="this.form.submit() I need to have a button when the user is happy they can go to the next screen but I need to be able to $_POST['TicketNumber'] so I can then use this value in for loop to generate name boxes thanks.

p.s I am gonna need this vale on a lot of pages as it will be used to generate contenets based on how many tickets they want is there a better way to do this?
__________________

Please login or register to view this content. Registration is FREE

Last edited by millwalll; 04-04-2010 at 05:16 PM..
millwalll is offline
Reply With Quote
View Public Profile Visit millwalll's homepage!
 
Old 04-04-2010, 05:20 PM Re: Help with drop down buttons
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Pass the value in a form, a session variable, or a cookie.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Help with drop down buttons
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13757 seconds with 12 queries