Jump to content

LearningKid

Members
  • Posts

    57
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

LearningKid's Achievements

Member

Member (2/5)

0

Reputation

  1. hey can anyone show me how to make 2 radio with 2 dropdown menu so if u select one radio button u will get to select one dropdown and if u select the other u get the other dropdown. however if u change one drop down and decide to choose the other one when u click the other one the 1st one resets so u dont get 2 values sent. Hlp Plz
  2. an anyone show me how to echo a dropdown menu after selecting a radio button? exmaple (Radio Button) Numbers 1-5 () (Hidden Dropdown Menu if above selected)1,2,3,4,5 (Radio Button) Numbers 6-10 () (Hidden Dropdown Menu if above selected)6,7,8,9,10 something like tht. Thank You
  3. Ok so i kinda played around and got it working now i jsut need it to select the correct Valeu cause it just keeps selecting the last valeu from my db, i want it select watever value i select from the dropdown menu. Any ideas how to do tht anyone? <?php session_start(); if(!session_is_registered(myusername)){ header("location:login.php"); } echo "Hi $_SESSION[myusername] <br /><br />"; ?> <html> <body> <?php $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="test"; // Database name $tbl_name="modify"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql= "SELECT * FROM `modify` ORDER BY `ID` ASC"; $result = mysql_query($sql); $rows = mysql_num_rows($result); ?> <form action="count.php" method="post"> <strong><a href="javascript:void(0);" onClick="document.getElementById('tab1').style.display='block';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';" onDblClick="document.getElementById('tab1').style.display='none';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';">Pages</a></strong><br /> <div id="tab1" style="display:none; font-size:11;"> Single Sided B&W <input type="radio" name="bw/c" value="1" /><br /> Double Sided B&W <input type="radio" name="bw/c" value="2" /><br /> Single Sided Colour <input type="radio" name="bw/c" value="3" /><br /> Double Sided Colour <input type="radio" name="bw/c" value="4" /><br /> <?php echo '<select name="Ptype">'; while($data = mysql_fetch_assoc($result)) { echo '<option name="bw/c/pt" value="'.$data['Valeu'].'">'.$data['Name'].'</option>'."\n"; } echo '</select>'; ?> </div><!-- <strong><a href="javascript:void(0);" onClick="document.getElementById('tab2').style.display='block';document.getElementById('tab1').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';" onDblClick="document.getElementById('tab1').style.display='none';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';">Binding and Stapling</a></strong><br /> <div id="tab2" style="display:none;"> None <input type="radio" name="s/b" value="0" /><br /> Spiral <input type="radio" name="s/b" value="1" /><br /> <select name="Spitype"> <option name="s/b/spty" value="1a" >Cerlox/Comb <option name="s/b/spty" value="1b" >Wireless <option name="s/b/spty" value="2c" >Coil </select> <br> Staples <input type="radio" name="s/b" value="2" /><br /> <select name="Spitype"> <option name="s/b/stty" value="2a" >Top <option name="s/b/stty" value="2b" >Side <option name="s/b/stty" value="2c" >Bottom </select><br> </div> <strong><a href="javascript:void(0);" onClick="document.getElementById('tab3').style.display='block';document.getElementById('tab1').style.display='none';document.getElementById('tab2').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';" onDblClick="document.getElementById('tab1').style.display='none';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';">Covers</a></strong><br /> <div id="tab3" style="display:none;"> None<input type="radio" name="c" value="0" /><br> Front Cover<br> Standard Front Cover <input type="radio" name="c" value="1" /><br> <select name="CovType"> <option name="c/cty" value="1a" >No Printing <option name="c/cty" value="1b" >Print B&W <option name="c/cty" value="1c" >Print Colour </select><br> <select name="Ptype"> <option name="bw/c/pt" value="1" selected>[Paper Colour/Type] <option name="bw/c/pt" value="1" >White <option name="bw/c/pt" value="2" >Red <option name="bw/c/pt" value="3" >Blue <option name="bw/c/pt" value="4" >Green </select><br> Standard Back Cover <input type="radio" name="c" value="2" /><br> <select name="CovType"> <option name="c/cty" value="2a" >No Printing <option name="c/cty" value="2b" >Print B&W <option name="c/cty" value="2c" >Print Colour </select><br> <select name="Ptype"> <option name="bw/c/pt" value="1" selected>[Paper Colour/Type] <option name="bw/c/pt" value="1" >White <option name="bw/c/pt" value="2" >Red <option name="bw/c/pt" value="3" >Blue <option name="bw/c/pt" value="4" >Green </select><br> Premium Back Cover <input type="radio" name="c" value="3" /><br> <select name="CovType"> <option name="c/cty" value="3a" >Clear <option name="c/cty" value="3b" >Vinyl Black <option name="c/cty" value="3c" >Linen Blue </select><br> </div> <strong><a href="javascript:void(0);" onClick="document.getElementById('tab4').style.display='block';document.getElementById('tab1').style.display='none';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';" onDblClick="document.getElementById('tab1').style.display='none';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';">Tabs</a></strong><br /> <div id="tab4" style="display:none;"> Bank<br> <select name="BaType"> <option name="t/tty" value="1a" >Full-cut 5 </select><br> Font<br> <select name="FoType"> <option name="t/tty" value="2a" >Arial </select><br> Label<br> <input type="text"><br> Font Size<br> <select name="F/size"> <option name="t/tty" value="3a" >12 <option name="t/tty" value="3b" >10 <option name="t/tty" value="3c" >8 </select><br> </div> <strong><a href="javascript:void(0);" onClick="document.getElementById('tab5').style.display='block';document.getElementById('tab1').style.display='none';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab6').style.display='none';" onDblClick="document.getElementById('tab1').style.display='none';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';">Special Instuctions</a></strong><br /> <div id="tab5" style="display:none;"> <textarea></textarea><br> <input type="checkbox" name="si/cty" value="1">Cutting<br> <select name="si/cty"> <option name="si/cty" value="1a" >Horizontal <option name="si/cty" value="1b" >Vertical <option name="si/cty" value="1c" >BlahBlah </select><br> <input type="checkbox" name="si/fty" value="1">Folding<br> <select name="si/fty" > <option name="si/fty" value="2a" >Horizontal <option name="si/fty" value="2b" >Vertical <option name="si/fty" value="2c" >BlahBlah </select><br> <input type="checkbox" name="si/lty" value="1">Laminating<br> <select name="si/lty" > <option name="si/lty" value="3a" >5mm <option name="si/lty" value="3b" >10mm </select><br> </div> --> <input type="submit" value="Total" /> </form> <?php require_once ('includes.php'); // set quantity $quantity = 4; $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="test"; // Database name $tbl_name="modify"; // Table name // Connect to server and select databse. $answer = $_POST['bw/c/pt']; if ($answer == $data['Valeu']) { mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql= "SELECT * FROM `modify` WHERE Price = Valeu"; $result = mysql_query($sql); $rows = mysql_num_rows($result); while($data = mysql_fetch_assoc($result)) { $origPrice = $data['Price'] ; } } else { // set original and current unit price $origPrice = 20; } // set original and current unit price $currPrice = $origPrice * $quantity; // calculate difference in price $tax = 16; // calculate percentage change in price $PriceTaxed = round((($currPrice * $tax)/100) + $currPrice,0); ?> <strong> <div id="tab6" style="display:block;"> <table border="1" cellpadding="5" cellspacing="0" > <tr><td>Quantity</td><td>Cost price Per Page</td><td>Current price Without Vat</td><td>Vat</td><td>Total Cost With Vat</td> </tr> <tr align="center"><td> <?php echo $quantity; ?></td><td>$ <?php echo $origPrice; ?></td><td>$ <?php echo $currPrice; ?></td><td> <?php echo $tax; ?>%</td><td>$ <?php echo $PriceTaxed; ?></td> </tr> </table><br /><br /> </div> <a href="logout.php">leave</a> </body> </html>
  4. Hi im tryin to get some calculations done but im not sure wat im doing wrong can anyone hlp <?php session_start(); if(!session_is_registered(myusername)){ header("location:login.php"); } echo "Hi $_SESSION[myusername] <br /><br />"; ?> <html> <body> <?php $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="test"; // Database name $tbl_name="modify"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql= "SELECT * FROM `modify` ORDER BY `ID` ASC"; $result = mysql_query($sql); $rows = mysql_num_rows($result); ?> <form action="count.php" method="post"> <strong><a href="javascript:void(0);" onClick="document.getElementById('tab1').style.display='block';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';" onDblClick="document.getElementById('tab1').style.display='none';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';">Pages</a></strong><br /> <div id="tab1" style="display:none; font-size:11;"> Single Sided B&W <input type="radio" name="bw/c" value="1" /><br /> Double Sided B&W <input type="radio" name="bw/c" value="2" /><br /> Single Sided Colour <input type="radio" name="bw/c" value="3" /><br /> Double Sided Colour <input type="radio" name="bw/c" value="4" /><br /> <?php echo '<select name="Ptype">'; while($data = mysql_fetch_assoc($result)) { echo '<option name=bw/c/pt value="'.$data['Valeu'].'">'.$data['Name'].'</option>'."\n"; } echo '</select>'; ?> </div> <strong><a href="javascript:void(0);" onClick="document.getElementById('tab2').style.display='block';document.getElementById('tab1').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';" onDblClick="document.getElementById('tab1').style.display='none';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';">Binding and Stapling</a></strong><br /> <div id="tab2" style="display:none;"> None <input type="radio" name="s/b" value="0" /><br /> Spiral <input type="radio" name="s/b" value="1" /><br /> <select name="Spitype"> <option name="s/b/spty" value="1a" >Cerlox/Comb <option name="s/b/spty" value="1b" >Wireless <option name="s/b/spty" value="2c" >Coil </select> <br> Staples <input type="radio" name="s/b" value="2" /><br /> <select name="Spitype"> <option name="s/b/stty" value="2a" >Top <option name="s/b/stty" value="2b" >Side <option name="s/b/stty" value="2c" >Bottom </select><br> </div> <strong><a href="javascript:void(0);" onClick="document.getElementById('tab3').style.display='block';document.getElementById('tab1').style.display='none';document.getElementById('tab2').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';" onDblClick="document.getElementById('tab1').style.display='none';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';">Covers</a></strong><br /> <div id="tab3" style="display:none;"> None<input type="radio" name="c" value="0" /><br> Front Cover<br> Standard Front Cover <input type="radio" name="c" value="1" /><br> <select name="CovType"> <option name="c/cty" value="1a" >No Printing <option name="c/cty" value="1b" >Print B&W <option name="c/cty" value="1c" >Print Colour </select><br> <select name="Ptype"> <option name="bw/c/pt" value="1" selected>[Paper Colour/Type] <option name="bw/c/pt" value="1" >White <option name="bw/c/pt" value="2" >Red <option name="bw/c/pt" value="3" >Blue <option name="bw/c/pt" value="4" >Green </select><br> Standard Back Cover <input type="radio" name="c" value="2" /><br> <select name="CovType"> <option name="c/cty" value="2a" >No Printing <option name="c/cty" value="2b" >Print B&W <option name="c/cty" value="2c" >Print Colour </select><br> <select name="Ptype"> <option name="bw/c/pt" value="1" selected>[Paper Colour/Type] <option name="bw/c/pt" value="1" >White <option name="bw/c/pt" value="2" >Red <option name="bw/c/pt" value="3" >Blue <option name="bw/c/pt" value="4" >Green </select><br> Premium Back Cover <input type="radio" name="c" value="3" /><br> <select name="CovType"> <option name="c/cty" value="3a" >Clear <option name="c/cty" value="3b" >Vinyl Black <option name="c/cty" value="3c" >Linen Blue </select><br> </div> <strong><a href="javascript:void(0);" onClick="document.getElementById('tab4').style.display='block';document.getElementById('tab1').style.display='none';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';" onDblClick="document.getElementById('tab1').style.display='none';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';">Tabs</a></strong><br /> <div id="tab4" style="display:none;"> Bank<br> <select name="BaType"> <option name="t/tty" value="1a" >Full-cut 5 </select><br> Font<br> <select name="FoType"> <option name="t/tty" value="2a" >Arial </select><br> Label<br> <input type="text"><br> Font Size<br> <select name="F/size"> <option name="t/tty" value="3a" >12 <option name="t/tty" value="3b" >10 <option name="t/tty" value="3c" >8 </select><br> </div> <strong><a href="javascript:void(0);" onClick="document.getElementById('tab5').style.display='block';document.getElementById('tab1').style.display='none';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab6').style.display='none';" onDblClick="document.getElementById('tab1').style.display='none';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';">Special Instuctions</a></strong><br /> <div id="tab5" style="display:none;"> <textarea></textarea><br> <input type="checkbox" name="si/cty" value="1">Cutting<br> <select name="si/cty"> <option name="si/cty" value="1a" >Horizontal <option name="si/cty" value="1b" >Vertical <option name="si/cty" value="1c" >BlahBlah </select><br> <input type="checkbox" name="si/fty" value="1">Folding<br> <select name="si/fty" > <option name="si/fty" value="2a" >Horizontal <option name="si/fty" value="2b" >Vertical <option name="si/fty" value="2c" >BlahBlah </select><br> <input type="checkbox" name="si/lty" value="1">Laminating<br> <select name="si/lty" > <option name="si/lty" value="3a" >5mm <option name="si/lty" value="3b" >10mm </select><br> </div> <input type="submit" value="Total" /> </form> <?php require_once ('includes.php'); // set quantity $quantity = 4; $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="test"; // Database name $tbl_name="modify"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql= "SELECT * FROM `modify` ORDER BY `ID` ASC"; $result = mysql_query($sql); $rows = mysql_num_rows($result); while($data = mysql_fetch_assoc($result)) { $answer = $_POST['bw/c/pt']; if ($answer == $data['Valeu']) { $origPrice = $data['Valeu'] ; } else { // set original and current unit price $origPrice = 20; } } // set original and current unit price $currPrice = $origPrice * $quantity; // calculate difference in price $tax = 16; // calculate percentage change in price $PriceTaxed = round((($currPrice * $tax)/100) + $currPrice,0); ?> <strong> <div id="tab6" style="display:block;"> <table border="1" cellpadding="5" cellspacing="0" > <tr><td>Quantity</td><td>Cost price Per Page</td><td>Current price Without Vat</td><td>Vat</td><td>Total Cost With Vat</td> </tr> <tr align="center"><td> <?php echo $quantity; ?></td><td>$ <?php echo $origPrice; ?></td><td>$ <?php echo $currPrice; ?></td><td> <?php echo $tax; ?>%</td><td>$ <?php echo $PriceTaxed; ?></td> </tr> </table><br /><br /> </div> <a href="logout.php">leave</a> </body> </html>
  5. i did but still seem to skip the part where its supposed to change the value when i select something else
  6. Hi this is some calculation i want but i seem to be doing a few things wrong can anyone hlp me? i want when i get $answer == data[Valeu] then the price must become data[Valeu] any hlp plz plz plz. <html> <body> <?php $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="test"; // Database name $tbl_name="modify"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql= "SELECT * FROM `modify` ORDER BY `ID` ASC"; $result = mysql_query($sql); $rows = mysql_num_rows($result); ?> <form action="count.php" method="post"> <strong><a href="javascript:void(0);" onClick="document.getElementById('tab1').style.display='block';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';" onDblClick="document.getElementById('tab1').style.display='none';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';">Pages</a></strong><br /> <div id="tab1" style="display:none; font-size:11;"> Single Sided B&W <input type="radio" name="bw/c" value="1" /><br /> Double Sided B&W <input type="radio" name="bw/c" value="2" /><br /> Single Sided Colour <input type="radio" name="bw/c" value="3" /><br /> Double Sided Colour <input type="radio" name="bw/c" value="4" /><br /> <?php echo '<select name="Ptype">'; while($data = mysql_fetch_assoc($result)) { echo '<option name=bw/c/pt value="'.$data['Valeu'].'">'.$data['Name'].'</option>'."\n"; } echo '</select>'; ?> <input type="submit" value="Total" /> </form> <?php require_once ('includes.php'); // set quantity $quantity = 4; $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="test"; // Database name $tbl_name="modify"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql= "SELECT * FROM `modify` ORDER BY `ID` ASC"; $result = mysql_query($sql); $rows = mysql_num_rows($result); while($data = mysql_fetch_assoc($result)) { $answer = $_POST['bw/c/pt']; if ($answer == $data['Valeu']) { $origPrice = 22 ; } else { // set original and current unit price $origPrice = 20; } } // set original and current unit price $currPrice = $origPrice * $quantity; // calculate difference in price $tax = 16; // calculate percentage change in price $PriceTaxed = round((($currPrice * $tax)/100) + $currPrice,0); ?> <strong> <div id="tab6" style="display:block;"> <table border="1" cellpadding="5" cellspacing="0" > <tr><td>Quantity</td><td>Cost price Per Page</td><td>Current price Without Vat</td><td>Vat</td><td>Total Cost With Vat</td> </tr> <tr align="center"><td> <?php echo $quantity; ?></td><td>$ <?php echo $origPrice; ?></td><td>$ <?php echo $currPrice; ?></td><td> <?php echo $tax; ?>%</td><td>$ <?php echo $PriceTaxed; ?></td> </tr> </table><br /><br /> </div> <a href="logout.php">leave</a> </body> </html>
  7. ok so this is what i have. in my db i have a table named Valeu which has amounts tht i want to be added lik 2,4,6,8, etc. however i dont get it to add the valeu amt in calculations. <?php $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="test"; // Database name $tbl_name="modify"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql= "SELECT * FROM `modify` ORDER BY `ID` ASC"; $result = mysql_query($sql); $rows = mysql_num_rows($result); ?> <form action="count.php" method="post"> <strong><a href="javascript:void(0);" onClick="document.getElementById('tab1').style.display='block';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';" onDblClick="document.getElementById('tab1').style.display='none';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';">Pages</a></strong><br /> <div id="tab1" style="display:none; font-size:11;"> Single Sided B&W <input type="radio" name="bw/c" value="1" /><br /> Double Sided B&W <input type="radio" name="bw/c" value="2" /><br /> Single Sided Colour <input type="radio" name="bw/c" value="3" /><br /> Double Sided Colour <input type="radio" name="bw/c" value="4" /><br /> <?php echo '<select name="Ptype">'; while($data = mysql_fetch_assoc($result)) { echo '<option name=bw/c/pt value="'.$data['Valeu'].'">'.$data['Name'].'</option>'."\n"; } echo '</select>'; ?> <?php require_once ('includes.php'); // set quantity $quantity = 4; $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="test"; // Database name $tbl_name="modify"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql= "SELECT * FROM `modify` ORDER BY `ID` ASC"; $result = mysql_query($sql); $rows = mysql_num_rows($result); while($data = mysql_fetch_assoc($result)) { $answer = $_POST['bw/c/pt']; if ($answer == $data['Valeu']) { $origPrice = $data['Valeu'] ; } else { // set original and current unit price $origPrice = 20; } } $quantity = 4; // set original and current unit price $currPrice = $origPrice * $quantity; // calculate difference in price $tax = 16; // calculate percentage change in price $PriceTaxed = round((($currPrice * $tax)/100) + $currPrice,0); ?> <strong> <div id="tab6" style="display:block;"> <table border="1" cellpadding="5" cellspacing="0" > <tr><td>Quantity</td><td>Cost price Per Page</td><td>Current price Without Vat</td><td>Vat</td><td>Total Cost With Vat</td> </tr> <tr align="center"><td> <?php echo $quantity; ?></td><td>$ <?php echo $origPrice; ?></td><td>$ <?php echo $currPrice; ?></td><td> <?php echo $tax; ?>%</td><td>$ <?php echo $PriceTaxed; ?></td> </tr> </table><br /><br /> </div> </body> </html>
  8. hi why cant i use $data['Valeu'] as the amount i want its a value im pullin from a db. <?php $quantity = 4; $answer = $_POST['bw/c/pt']; if ($answer == $data['Valeu']) { $origPrice = 22 ; } else { // set original and current unit price $origPrice = 20; } ?>
  9. Hi can someone tell me what im doing wrong here, i tried to call a few things form i db and i got them and then add them to a dropdown menu but i keep gett (">) next to the files im sure its just something small tht i missed a hundred times so if someone has beter eyes than mine hlp is appreciated. <?php session_start(); if(!session_is_registered(myusername)){ header("location:login.php"); } echo "Hi $_SESSION[myusername] <br /><br />"; ?> <html> <body> <?php $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="test"; // Database name $tbl_name="modify"; // Table name // Connect to server and select databse. mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $sql= "SELECT * FROM `modify` ORDER BY `ID` ASC"; $result = mysql_query($sql); $rows = mysql_num_rows($result); ?> <form action="count.php" method="post"> <strong><a href="javascript:void(0);" onClick="document.getElementById('tab1').style.display='block';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';" onDblClick="document.getElementById('tab1').style.display='none';document.getElementById('tab2').style.display='none';document.getElementById('tab3').style.display='none';document.getElementById('tab4').style.display='none';document.getElementById('tab5').style.display='none';document.getElementById('tab6').style.display='none';">Pages</a></strong><br /> <div id="tab1" style="display:none; font-size:11;"> Single Sided B&W <input type="radio" name="bw/c" value="1" /><br /> Double Sided B&W <input type="radio" name="bw/c" value="2" /><br /> Single Sided Colour <input type="radio" name="bw/c" value="3" /><br /> Double Sided Colour <input type="radio" name="bw/c" value="4" /><br /> <select name="Ptype" value="<?for ($i = 0; $i < $rows; $i++){$data = mysql_fetch_object($result);"$data->Valeu"?>"> <option name='bw/c/pt' value=''><?echo "$data->Name";}?> </select> </div> if you need the rest of the coding let me kno. Thank You
  10. Where shud i move it to, btw do i have to or can someone here hlp me?
  11. oh my bad i get lost in this place sry
  12. hi i posted this in the MySpl part but no responds can anyone chek this out for me? http://www.phpfreaks.com/forums/index.php/topic,281826.0.html
  13. Hi i was wondering if it is possible to add multible entries to a table, say i have <?php $sql="insert into colours (Color,Name,Value) values ('yes','blue','2')"; ?> if i want to add like yes,no,yes,no,yes,etc then red,white,orange,grey,orange,etc and then 2,3,4,5,6. anyway i can do tht?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.