Jump to content

searls03

Members
  • Posts

    907
  • Joined

  • Last visited

Everything posted by searls03

  1. Ok so I need to know how this code: <form> <?php // Query member data from the database and ready it for display $sql1 = mysql_query("SELECT * FROM products where id='".$pid."'"); while($row = mysql_fetch_array($sql1)){ $product =$row["product"]; $pid=$row["id"]; ?> <?php // Query member data from the database and ready it for display $sql4 = mysql_query("SELECT * FROM labels where item_id='".$pid."'"); while($row = mysql_fetch_array($sql4))for($i=0; $i<1; $i++){ $label =$row["label"]; $lid=$row['id']; echo $label; ?> <select name="name1[]"> <?php // Query member data from the database and ready it for display $sql3 = mysql_query("SELECT * FROM options where item_id='".$pid."' && label_id='".$lid."'"); while($row = mysql_fetch_array($sql3)){ $option =$row["option"]; ?> <option value="<?php echo $option; ?>"> <?php echo $option; ?> </option> <?php } ?> </select> </br> <?php } ?> <?php }?> If this product is for someone other than the listed, change it, otherwise leave it:<br /> <input ID="outputField<?php echo $id; ?>" name="name123" type="text" VALUE="..." /> <input name="qty" type="hidden" value="<?php echo $qty; ?>" /> <input type="submit" id="hellobob<?php echo $id; ?>" value="Submit" /> </form> specifically this part: <?php // Query member data from the database and ready it for display $sql4 = mysql_query("SELECT * FROM labels where item_id='".$pid."'"); while($row = mysql_fetch_array($sql4))for($i=0; $i<1; $i++){ $label =$row["label"]; $lid=$row['id']; echo $label; ?> <input type="text" name="name[]" /> <input type="text" name="name2[]" /> <select name="name1[]"> <?php // Query member data from the database and ready it for display $sql3 = mysql_query("SELECT * FROM options where item_id='".$pid."' && label_id='".$lid."'"); while($row = mysql_fetch_array($sql3)){ $option =$row["option"]; ?> <option value="<?php echo $option; ?>"> <?php echo $option; ?> </option> <?php } ?> </select> </br> I need to create an array from the name(1,2)[] parts. The thing is, they are going to be pulled in a loop and return all results. so there could be multiple name1[]'s name2[]'s or name[]'s. I need to know how I would combine each one in it's loop to make part of a string. thing is, the first time name[] would be included, second time it wouldn't be included. then the arrays combine to make one. so the final array looks like this name[] name1[] name2[] name1[] name2[] name1[] name2[]. etc. anyhelp on this?
  2. the code is like this : <?php // Query member data from the database and ready it for display $sql4 = mysql_query("SELECT * FROM labels where item_id='".$pid."'"); while($row = mysql_fetch_array($sql4))for($i=0; $i<1; $i++){ $label =$row["label"]; $lid=$row['id']; echo $label; ?> <?php echo "<input name=\"names[$i][name1]\" value=\"$label\" />\n"; echo "<select name=\"names[$i][name]\" />\n"; ?>
  3. ok. what is going to happen is the array fields are produced through a loop. the first loop I want the 0, second the 1, 3rd the 2. etc. when I say 0,1,or 2 I mean the name[1]. how do I do this?
  4. I don't know to read arays well so sorry. I didn't know that. To me it looks like they would be two values. Sorry bout that. Will that make it one string? The semicolons were part of the string that I wanted. Just want to make sure
  5. how exactly do they combine then? I am bad at writing arrays. Never have been able to, maybe someday will. anyways, could you help me with that.
  6. Ok, So what I need is a way for arrays to combine. My basic structure is going to look like this for the form that needs submission: <form> <input name="name[]" /> <input name="name1[]" /> <input name="name[]" /> <input name="name1[]" /> <input name="name[]" /> <input name="name1[]" /> </form> then on the page it submits to, I need an array to form that will combine all the inputs to looks something like this: "name" "name1"; "name" "name1"; "name" "name1";.......... where the first set is the first name and name1, second is second, third is third, etc. The string of arrays will only end when there are no more left, so if there were 6, it would combine 6. how do I do something like this?
  7. can anyone help me as to whay I get this error: Problem with the query: INSERT INTO options (item_id, option ) VALUES('1', 'hi' ) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'option ) VALUES('1', 'hi' )' at line 1 with this code: foreach($_POST["user"] AS $key => $val) { $user = $val; $id1 = $_POST['id1'][$key]; $sql = "INSERT INTO options (item_id, option ) VALUES('$id1', '$user' )"; $rs = mysql_query($sql) or die ("Problem with the query: $sql <br />" . mysql_error()); } <input type="checkbox" name="yes" id="checkme" /><div id = "extra"> <div id="user"> Enter User Names:<br> <input type="text" name="user[]"/><br></div> <div id="add_user" style="display: none;"><input type="text" name="user[]"/>
  8. you are correct. how do I set this up to work then? do I need html code for a ; or can I just enter the ;? this is scanning from a card, and then logging someone in. how would I do this so that they set correctoly?
  9. can anyone tell me why $username is not setting properly? the password is, but $username is no. it is setting as blank: if ($_POST['go']) { //Connect to the database through our include if ($_POST['logid'] == "&#59;5757120050531338739&#61;49121200000&#63;"){ $username="oldcheney"; $username = stripslashes($username); $username = strip_tags($username); $username= strtolower($username); $username = mysql_real_escape_string($username); $password="password";} else if($_POST['logid']=="&#59;5757120050531338721&#61;49121200000&#63;"){ $username="yankeehill"; $password="password";} else if($_POST['logid']=="%6277202936423578^00000000^X&#63;"){ $username="holdrege"; $password="password";} $password = md5($password);
  10. ok. this may make now sense at all, I will try to explain as best as I can. anyways, what I need is for a mysql query to run that will pull all data from table payment between certain days. Then all the rows will show, but I want only one row with each cart_id(there will be multiple) to show. After it does that, in a new column on a table, all the payment types with the amount will show with a slash between each one. I want all of this in a table generated from a php loop. maybe a visual represenation will be better. I hope the picture I attached makes a bit more sense.
  11. so yeah, the div unsets the value, then when I refresh the page, it resets it.Why!!!!!!!!!
  12. ill try. the div "more" is not in a loop or anything, I don't know why it makes it twice.
  13. this is from firebug, but this is what it looks like it is doing: <div class="more"> <div class="more"> you still need: <br> </div> </div> making a second div
  14. it is taking out $total. I echoed it out inside the div "more" and that is where it is like unsetting or something.
  15. no, it was the same result, still is like takin the value away.
  16. it is set. it seems the code tries to take $total away from that Div, i don't know why it does that.
  17. here is whole code: <?php session_start(); require_once "connect.php"; if(isset($_SESSION['logged'])){ // Query member data from the database and ready it for display $cid = $_SESSION['complete']; $academy = $_SESSION['academy']; $sql = mysql_query("SELECT * FROM login where academy ='$academy'"); while($row = mysql_fetch_array($sql)){ $date =$row["date"]; if ($date !=="".date('m-d-Y')){echo '<meta http-equiv="REFRESH" content="0;url=login.php">'; exit(); } } }else{ echo '<meta http-equiv="REFRESH" content="0;url=login.php">'; exit(); } echo $cid; echo $academy; if($_POST['total']){ $total = $_POST['total']; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> <script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script><script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="http://ajax.microsoft.com/ajax/jquery.validate/1.7/jquery.validate.min.js"></script> <script src="SpryAssets/SpryTabbedPanels.js" type="text/javascript"></script> <script> $(document).ready(function () { $("#cash").click(function(){ // Logic to determine the form is ok to submit. $("#types").hide(); $("#cash1").show(); }); }); </script> <script> $(document).ready(function () { $("#Check").click(function(){ // Logic to determine the form is ok to submit. $("#types").hide(); $("#Check1").show(); }); }); </script> <script> $(document).ready(function () { $("#credit").click(function(){ // Logic to determine the form is ok to submit. $("#types").hide(); $("#Credit1").show(); }); }); </script> <script> $(document).ready(function () { $("#Gift").click(function(){ // Logic to determine the form is ok to submit. $("#types").hide(); $("#Gift1").show(); }); }); </script> <script type="text/javascript"> $(document).ready(function(){ $("#myform").validate({ debug: false, submitHandler: function(form) { // do other stuff for a valid form $.post('', $("#myform").serialize(), function(data) { }); } }); }); </script> <script type="text/javascript"> $(document).ready(function(){ $("#myform2").validate({ debug: false, submitHandler: function(form) { // do other stuff for a valid form $.post('payment.php', $("#myform2").serialize(), function(data) { $("#types").show(); $("#cash1").hide(); $("#Credit1").hide(); $("#Check1").hide(); $("#Gift1").hide(); $("#more").load("collect.php #more"); $("#more").load("collect.php #more");$("#more").load("collect.php #more");$("#more").load("collect.php #more"); $("#more1").load("collect.php #more1"); }); } }); }); </script> <style type="text/css"> <!-- body { font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif; background: #42413C; margin: 0; padding: 0; color: #000; } /* ~~ Element/tag selectors ~~ */ ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */ padding: 0; margin: 0; } h1, h2, h3, h4, h5, h6, p { margin-top: 0; /* removing the top margin gets around an issue where margins can escape from their containing div. The remaining bottom margin will hold it away from any elements that follow. */ padding-right: 15px; padding-left: 15px; /* adding the padding to the sides of the elements within the divs, instead of the divs themselves, gets rid of any box model math. A nested div with side padding can also be used as an alternate method. */ } a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */ border: none; } /* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */ a:link { color: #42413C; text-decoration: underline; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */ } a:visited { color: #6E6C64; text-decoration: underline; } a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */ text-decoration: none; } /* ~~ this fixed width container surrounds the other divs ~~ */ .container { width: 960px; background: #FFF; margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout */ } /* ~~ the header is not given a width. It will extend the full width of your layout. It contains an image placeholder that should be replaced with your own linked logo ~~ */ .header { background: #ADB96E; } /* ~~ This is the layout information. ~~ 1) Padding is only placed on the top and/or bottom of the div. The elements within this div have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the div itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the div and place a second div within it with no width and the padding necessary for your design. */ .content { padding: 10px 0; } /* ~~ The footer ~~ */ .footer { padding: 10px 0; background: #CCC49F; } /* ~~ miscellaneous float/clear classes ~~ */ .fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */ float: right; margin-left: 8px; } .fltlft { /* this class can be used to float an element left in your page. The floated element must precede the element it should be next to on the page. */ float: left; margin-right: 8px; } .clearfloat { /* this class can be placed on a <br /> or empty div as the final element following the last floated div (within the #container) if the #footer is removed or taken out of the #container */ clear:both; height:0; font-size: 1px; line-height: 0px; } --> </style> <script src="SpryAssets/SpryAccordion.js" type="text/javascript"></script> <link href="SpryAssets/SpryAccordion.css" rel="stylesheet" type="text/css" /> </head> <body> <div class="container"> <div class="content"> <p>Please select payment type:</p> <p> </p> <?php setlocale(LC_MONETARY, "en_US"); echo money_format("The total is %n", $total);?> <p><br /> <br /> <form id="myform" name="myform" method="post" > <div class='label1' id='types'> <input type="submit" name="type" value="Cash" id="cash" onclick="textchanged1()" /> <input type="submit" name="type" value="Credit Card" id="credit" onclick="textchanged2()" /> <input type="submit" name="type" value="Check" id="Check" onclick="textchanged3()" /> <input type="submit" name="type" value="Gift Card" id="Gift" onclick="textchanged4()" /> </div> </form> <br /> <form id="myform2" name="myform2" method="post" > <?php // Query member data from the database and ready it for display $sql = mysql_query("SELECT * FROM cart where cart_id = '".$_SESSION['complete']."' && product123 !=''"); while($row = mysql_fetch_array($sql)){ $product = $row["product123"]; $price1 = $row["price"]; $id = $row["product_id"]; $qty = $row["quantity"]; $month = date("F Y"); $day = date("d"); $year = date("Y"); $date = date("Y-m-d"); ?> <input name="product[]" type="hidden" value="<?php echo $product; ?>" /> <input name="academy[]" type="hidden" value="<?php echo $academy; ?>" /> <input name="month[]" type="hidden" value="<?php echo $month; ?>" /> <input name="day[]" type="hidden" value="<?php echo $day; ?>" /> <input name="year[]" type="hidden" value="<?php echo $year; ?>" /> <input name="date[]" type="hidden" value="<?php echo $date; ?>" /> <input name="price[]" type="hidden" value="<?php echo $price1; ?>" /> <input name="id[]" type="hidden" value="<?php echo $id; ?>" /> <input name="qty[]" type="hidden" value="<?php echo $qty; ?>" /> <?php } ?> <input type="hidden" name="total" id="total" value="<?php echo $total; ?>" /> <div class='label1' id='cash1' style="display:none"> Please enter value given<br /> do not enter commas (,) or dollar signs ($) <br /> <input type="text" name="payment1" id="payment" /> <input type="hidden" name="type1" id="Cash2" /> <input name="submit1" type="submit" value="Checkout" /> </p></div> <div class='label1' id='Credit1' style="display:none"> Please enter value given <br /> do not enter commas (,) or dollar signs ($) <br /> <input type="text" name="payment2" id="payment" /> <input type="hidden" name="type2" id="Credit2" /> <input name="submit2" type="submit" value="Checkout" /> </p></div> <div class='label1' id='Check1' style="display:none"> Please enter value given <br /> do not enter commas (,) or dollar signs ($) <br /> <input type="text" name="payment3" id="payment" /> <input type="hidden" name="type3" id="Check2" /> <input name="submit3" type="submit" value="Checkout" /> </p></div> <div class='label1' id='Gift1' style="display:none"> Please enter value given <br /> do not enter commas (,) or dollar signs ($) <br /> <input type="text" name="payment4" id="payment" /> <input type="hidden" name="type4" id="Gift2" /> <input name="submit4" type="submit" value="Checkout" /> </p></div> </form> <?php echo $total; ?> <script type="text/javascript"> function textchanged1(){ var textTyped1 = document.getElementById('cash').value; document.getElementById('Cash2').value = textTyped1; } </script> <script type="text/javascript"> function textchanged2(){ var textTyped2 = document.getElementById('credit').value; document.getElementById('Credit2').value = textTyped2; } </script> <script type="text/javascript"> function textchanged3(){ var textTyped3 = document.getElementById('Check').value; document.getElementById('Check2').value = textTyped3; } </script> <script type="text/javascript"> function textchanged4(){ var textTyped4 = document.getElementById('Gift').value; document.getElementById('Gift2').value = textTyped4; } </script> <script type="text/javascript"> function textchanged(){ var textTyped = document.getElementById('pay123').value; document.getElementById('pay1234').value = '<?php echo $total; ?>' - textTyped; } </script> <br /> you still need:<div id="more"> <?php // Query member data from the database and ready it for display $sql = mysql_query("SELECT SUM(amount) AS total FROM payment where cart_id='$cid'"); while($row = mysql_fetch_array($sql)){ $amount123 = $row["total"]; ?> <?php } $left=$total-$amount123; ?></div> <div id="more1"> <?php echo $left; ?> <p> </p> <p> </p> </div><br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <!-- end .content --></div> <!-- end .container --></div> <script type="text/javascript"> var Accordion1 = new Spry.Widget.Accordion("Accordion1"); </script> </body> </html> $total is towards top, and the code is towards bottom. it supposed to refresh the div witch I want to update the total then.
  18. also does it this way too: <?php // Query member data from the database and ready it for display $sql = mysql_query("SELECT SUM(amount) AS total FROM payment where cart_id='$cid'"); while($row = mysql_fetch_array($sql)){ $amount123 = $row["total"]; } $left = $total-$amount123; ?><?php echo $left; ?>
  19. ok, so I can't seem to figure out why when I take this code: <?php // Query member data from the database and ready it for display $sql = mysql_query("SELECT SUM(amount) AS total FROM payment where cart_id='$cid'"); while($row = mysql_fetch_array($sql)){ $amount123 = $row["total"]; ?> <?php $left = $total-$amount123; } ?><?php echo $left; ?> I echo $left and instead of subtracting $amount123 from $total, it subtracts it from zero, but when I refresh the page, it works properly. can anyone see what the issue is?
  20. how would I do something like this? <?php } else if(strpos($val, 'Sparring') && strpos($val, 'head') == true){ ?> this doesn't return what would be inside it, but rather the last else condition....I need to be the same string it is pulling from, but looking to make sure two words are contained in it.
  21. but won't that hide it even when the script tells it to show?
  22. how do I hide the thank you div by default?
×
×
  • 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.