| | |
Parsing variabls to texbox
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jan 2005
Posts: 9
Reputation:
Solved Threads: 0
Morning all,
I don't know how to solve this problem Here it is:
In form html
Result: qty value: 1
When I change qty to 0, 1, 2, 3, 4, etc.. gross value stay ar 20.45.
What is wrong in my code ?
Regards to all.
I don't know how to solve this problem Here it is:
•
•
•
•
$price_unit = "20.45"
$qty = 'qty';
$net = 'net';
$net = $qty * $price_unit ;
as: 0<$qty<10 to parse in a textbox.
I do that :
if
($qty =0)
{
$net =0;
}
elseif
($qty =1) {
$net = $price_unit * 1;
}
elseif
($qty = 2) {
$net = $price_unit * 2;
}
....
else{echo "Message...."}
•
•
•
•
.....
<input type = "text" name = "qty" value = "<?php echo $qty ?>" size = "6">
<input type = "text" name = "gross" value = "$qty * $price_unit" size = "6">
When I change qty to 0, 1, 2, 3, 4, etc.. gross value stay ar 20.45.
What is wrong in my code ?
Regards to all.
Your code:
$price_unit = "20.45" // this is not numeric
$qty = 'qty'; // this mean the value in $qty is a word
$net = 'net'; // this mean the value in $net is a word
They should look like:
$price_unit = 20.45; // this is now numeric value
$qty = $_POST['qty']; // assume you use post in the form
$net = $proce_unit*$qty;
To set the condition, use if...else function.
$price_unit = "20.45" // this is not numeric
$qty = 'qty'; // this mean the value in $qty is a word
$net = 'net'; // this mean the value in $net is a word
They should look like:
$price_unit = 20.45; // this is now numeric value
$qty = $_POST['qty']; // assume you use post in the form
$net = $proce_unit*$qty;
To set the condition, use if...else function.
![]() |
Similar Threads
- Parsing html form. (PHP)
- parsing error (XML file-java-schema) (Java)
- Parsing an atom feed (PHP)
- File parsing in 'C' (C)
Other Threads in the PHP Forum
- Previous Thread: This ought to be simple - extra spaces
- Next Thread: Seeting up and calling variables stored in sessions
| Thread Tools | Search this Thread |
advanced apache api array beginner binary broken cakephp check checkbox class cms code cookies cron curl database date datepart display dropdownlist dynamic echo email eregi error execution file files folder form forms function functions google head href htaccess html if...loop image include includingmysecondfileinthechain insert ip javascript job joomla jquery key library limit link login mail menu mlm multiple mysql oop password paypal pdf pdfdownload php phpvotingscript problem query radio random recursion remote screen script search server sessions smarty sms sorting source space sql startup stored syntax system table traffic tutorial unicode update upload url validator variable video web youtube zend





