Jump to content

LearningKid

Members
  • Posts

    57
  • Joined

  • Last visited

    Never

Everything posted by LearningKid

  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?
  14. Hi Can anyone hlp me wit a code tht will do calculations witout havin to reload a page?
  15. something like this but without the submit button i want when i selct a radio button it automatically updates the price to wat i selected and keep the radio button cheked. Thank You hope this will hlp <html> <body> <form action="count.php" method="post"> B&W <input type="radio" name="bw/c" value="1" /><br /> Color <input type="radio" name="bw/c" value="2" /><br /> <input type="submit" value="submit" /> </form> <?php require_once ('includes.php'); // set quantity $quantity = 4; $answer = $_POST['bw/c']; if ($answer == "2") { $origPrice = 22; } else { // set original and current unit price $origPrice = 20; } $currPrice = $origPrice * $quantity; // calculate difference in price $tax = 16; // calculate percentage change in price $PriceTaxed = round((($currPrice * $tax)/100) + $currPrice,0); ?> <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 /><a href="logout.php">leave</a> </body> </html>
  16. Im getting the Info give me a few mins
  17. Hey im not sure how to do this, I have a page tht calculates cost for something, now i want to add radio buttons so tht if someone has to print something price can increase as ppl select the buttons, default will be ur printin B&W and the options wud be Color, or Single Side Printing or Double side. this is what i have so far. <?php $quantity = $_POST['pages']; // set original and current unit price // LIKE HERE THE DEFAULT PRICE WUD BE $20 AND IF ITS COLOR THE PRICE CHANGES TO $22 $origPrice = 20; $currPrice = $origPrice * $quantity; // calculate difference in price $tax = 16; // calculate percentage change in price $PriceTaxed = round((($currPrice * $tax)/100) + $currPrice,0); ?> Any hlp wud be appreciated Thank You
  18. Hey Thank You, I just added raio buttons and then they selct wchi file they want then edit button out of the form and it worked.
  19. Hi i have this code that i tried to make to send some info from one page to aother with lots of ppls hlp and it works ok but when i have multiple files it doesnt send the correct info. What im tryin to get is the Num_Pages to another page it works fine if its just one file in the db but when its multiple and i select a file in the middle of the table or somewhere else i dont get tht info i get the last file info. Can anyone help if I didnt confuse u? Thank You <?php // 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 files where username = '".$_SESSION['myusername']."' ORDER BY id ASC "; //$sql = "ORDER BY id ASC"; $result = mysql_query($sql); $rows = mysql_num_rows($result); echo "<form method='POST' action='count.php'><table border='2px'>\n"; echo " <tr>\n"; echo " <td align='center'>Date Added</td>\n"; echo " <td align='center'>Files</td>\n"; echo " <td align='center'>Number of Pages</td>\n"; echo " <td align='center'>Prepare To Print</td>\n"; echo " <td> </td>\n"; echo " </tr>\n"; for ($i = 0; $i < $rows; $i++) { $data = mysql_fetch_object($result); // since our script is very small, i'm not going to escape out to html mode here echo " <tr>\n"; echo " <td>$data->Date</td>\n"; echo " <td>$data->File_Name</td>\n"; echo " <td align='center'><input name='pages' type='hidden' value='$data->Num_Pages'>$data->Num_Pages</td>\n"; echo " <td align='center'> <input type='submit' value='Edit' name='editbutton'></form></td>"; echo " </tr>\n"; } ?>
  20. lol i got the action post thingy, and thank you all one last thing i tried playin around but how do i get the info on the other page? i tried something like <?php if ($_POST['infoineed']) {echo $_POST['infoineed'] }; ?> but tht obviosly doesnt work lol so im lookin online to figure it out if u guys have any hlp please assist. Thank YOu
  21. Hi so i have this code tht grabs some info from my db now there is an edit button now i want to kno if anyone can hlp me so tht when i click the eidt button it grabs the number of pages and take it to another page tht i have created. looking forward to your kind hlp <?php session_start(); if(!session_is_registered(myusername)){ header("location:login.php"); } echo "Hi $_SESSION[myusername] <br /><br />"; $host="localhost"; // Host name $username="root"; // Mysql username $password=""; // Mysql password $db_name="test"; // Database name $tbl_name="files"; // 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 files where username = '".$_SESSION['myusername']."' ORDER BY id ASC "; //$sql = "ORDER BY id ASC"; $result = mysql_query($sql); $rows = mysql_num_rows($result); echo "<table border='2px'>\n"; echo " <tr>\n"; echo " <td align='center'>Date Added</td>\n"; echo " <td align='center'>Files</td>\n"; echo " <td align='center'>Number of Pages</td>\n"; echo " <td align='center'>Prepare To Print</td>\n"; echo " <td> </td>\n"; echo " </tr>\n"; for ($i = 0; $i < $rows; $i++) { $data = mysql_fetch_object($result); // since our script is very small, i'm not going to escape out to html mode here echo " <tr>\n"; echo " <td>$data->Date</td>\n"; echo " <td>$data->File_Name</td>\n"; echo " <td align='center'>$data->Num_Pages</td>\n"; echo " <td align='center'><button>Edit</Button></td>\n"; echo " </tr>\n"; } ?> <html> <body> <a href="logout.php">leave</a> </button> </body> </html>
×
×
  • 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.