Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,150,259 members, 7,807,890 topics. Date: Wednesday, 24 April 2024 at 09:58 PM |
Nairaland Forum / Science/Technology / Programming / Pls Programmers In PHP And MYSQL Help Out On This (1281 Views)
Pls Programmers Help With Similarities Of Pseudocode & Algorithm / Android Quiz Application With Json Parser, Php And Mysql Database / Why Do Seun Dont Like Php And Mysql Programmers (2) (3) (4)
Pls Programmers In PHP And MYSQL Help Out On This by dmark4real: 5:26pm On Nov 01, 2012 |
Pls my honorable programmers in the house, i have a problem with the following code: I want the code to calculate the amount whenever the quantity and the rate is selected but i get undefined index and i need the page to automatically calculate and display the amount when the quantity and rate is selected without having to click anything. I hope anyone understand this. <?php $qty = $_GET['qty']; $rate = $_GET['rate']; $amt = ($qty*$rate); ?> <form action="<?php $_SERVER['PHP_SELF']; ?>" method="get"> <table width="200" border="1"> <tr> <td>Qty</td> <td><select name="qty"><option value="1">1</option><option value="2">2</option><option value="3">3</option></select> </td> </tr> <tr> <td>Description</td> <td><input type="text" name="des" /> </td> </tr> <tr> <td>Rate</td> <td><input type="text" name="rate"/> </td> </tr> <tr> <td>Amount</td> <td><input type="text" name="amount" value="<?php echo $amt; ?>" /> </td> </tr> <tr> <td> </td> <td><input type="submit" name="submit" value="Save" /> </td> </tr> </table> The info will be sent into the database when the button save is clicked. </form> |
Re: Pls Programmers In PHP And MYSQL Help Out On This by jboy01(m): 6:24pm On Nov 01, 2012 |
dmark4real: Pls my honorable programmers in the house, i have a problem with the following code: I want the code to calculate the amount whenever the quantity and the rate is selected but i get undefined index and i need the page to automatically calculate and display the amount when the quantity and rate is selected without having to click anything. I hope anyone understand this.With my little knowledge, I think web application development is not like pc application, the page need to load to carry out the instructions that is the ($AMT*$RATE). And for the system to carry out the insructions, u need to click on the submit button. |
Re: Pls Programmers In PHP And MYSQL Help Out On This by Nobody: 9:19pm On Nov 01, 2012 |
the php code part will run everytime, including the first moment you try to load the page you need to add a condition to the php code to run only when the submit button is clicked
|
Re: Pls Programmers In PHP And MYSQL Help Out On This by bakenda(m): 12:01pm On Nov 02, 2012 |
dmark4real: i need the page to automatically calculate and display the amount when the quantity and rate is selected without having to click anything. I hope anyone understand this. You will need JavaScript to do that, look into the JavaScript onBlur event. |
Re: Pls Programmers In PHP And MYSQL Help Out On This by ChelaTheGreat: 12:47pm On Nov 02, 2012 |
2 Likes |
Re: Pls Programmers In PHP And MYSQL Help Out On This by olyjosh(m): 2:12pm On Nov 09, 2012 |
php is a server side scripting language. It perform it operation on the server, hence can not perform such operation without loading the browser. The solution to this problem is to use java script events onBlur or onChange to handle the event that will be carried out immeditely the mouse is no more on the form element (e.g textField) then pass the answer to a variable that you will now send via GET or POST request to php processing script on ur web-server. such that the variable is the anwser that is been passed to ur database. Take a look at what @ChelaTheGreat is having for you 1 Like |
Re: Pls Programmers In PHP And MYSQL Help Out On This by dmark4real: 11:18am On Nov 16, 2012 |
Thanks to you all. I tried javascript and it works tanks alot. |
(1) (Reply)
Help Me Fix My Java Login Code Error / Need Help With AIML On Android / HELP HELP HELP ........I NEED ADMIN FEAUTURES IN MY FORUM
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 24 |