Jump to content

JamesB

Members
  • Posts

    425
  • Joined

  • Last visited

Everything posted by JamesB

  1. Ah thanks! had a feeling it was that.
  2. In this thread http://w3schools.invisionzone.com/index.php?showtopic=51196 in the link he gave: http://jsfiddle.net/96eLrn6e/ He defines 2 local variables in a lambda, but then uses one of those variables outside the lambda, why does that work? I was thinking that the local variables in the lambda would be destroyed when the lambda finishes executing.
  3. Use onkeyup instead. The element's value hasn't been updated until both functions have finished executing.
  4. But he's sending it as a parameter
  5. yeh I'm not sure which event will take priority for disabling the input on this one: but both functions should be called. <input id="lol" type="text" name="form_number" size="20" onkeypress='return isNumberKey(event)' onkeydown='return isNumberKey(event)'> <input id="lol" type="text" name="form_number" size="20" onkeypress='return (isNumberKey(event) && function2(event))'>
  6. Okay, but can you please post your latest code?
  7. https://www.google.co.uk/?gws_rd=ssl#q=how+to+delete+cookies
  8. That line looks fine. What is your latest code? And did you delete your cookies?
  9. What's the latest code you have?
  10. Remove this line: $sql.=$id.","; Then add: echo $sql; after your foreach loop. You will need to reset your cookies and run the page again which stores data into the session.
  11. Okay, check my previous post though I posted another update. And dont forget to update this one from 'cart' to 'paniers' <td><?php print $_SESSION['cart'][$produit['name']]*$produit['quantity'];?>€</td>
  12. Also in paniers.php, change $this->name = $nom; to $this->nom = $nom; and change foreach($_SESSION['paniers'] as $id =>$value) {$sql.=$id.",";} to foreach($_SESSION['paniers'] as $name=>$value) {$sql.="'".$name."',";}
  13. Rename your other 2 occurrences of $_SESSION['cart'] to $_SESSION['paniers']
  14. change if(isset($_SESSION['cart'])){ to if(isset($_SESSION['paniers'])){ you forgot to rename one
  15. yeh basically. $_SESSION is an array. $_SESSION['cart'] is an element in that array. So somewhere in your code a value should be assigned to $_SESSION['code']. Can you post the code in panier.php?
  16. I don't see 'cart' in that output. So $_SESSION['cart'] is not set.
  17. That would suggest to me that this line is evaluating to false: if(isset($_SESSION['cart'])){ try debugging your session by adding: print_r($_SESSION);if(isset($_SESSION['cart'])){
  18. When u run the file, which number is being displayed on the page? a zero?
  19. Check how many rows are returned in your query $query=mysql_query($sql);echo mysql_num_rows($query).'<br>';
  20. Well you are overwriting the $produit variable from the database. Try removing the foreach loop. Change <?php foreach($listproduit as $produit) { ?><tr><td><?php print $produit['name'] ?></td><td><?php print $produit['price'] ?></td><td><?php print $produit['quantity'] ?></td><td><?php print $_SESSION['cart'][$produit['name']]*$produit['quantity']?></td></tr><?php } ?> to <tr><td><?php print $produit['name'] ?></td><td><?php print $produit['price'] ?></td><td><?php print $produit['quantity'] ?></td><td><?php print $_SESSION['cart'][$produit['name']]*$produit['quantity']?></td></tr>
  21. Okay forget the semilcolon. Try changing: </tr><?php } ?></table><?php } ?><p><a href="index.php">Home[/url]</p> to: </tr><?php } ?><?php } ?><?php } ?></table><?php } ?><p><a href="index.php">Home[/url]</p>
  22. Well it should work, are you sure your while loop code works? Try adding print_r($battlepokemon); after your while loop to verify the array data.
  23. You are missing a closing bracket } for: if(isset($_SESSION['cart'])){ and <?php } else {?> Also you haven't put a semicolon at the end of these 4 PHP lines: <td><?php print $produit['name'] ?></td><td><?php print $produit['price'] ?></td><td><?php print $produit['quantity'] ?></td><td><?php print $_SESSION['cart'][$produit['name']]*$produit['quantity']?></td>
  24. foreach($battlepokemon as $key => $value){ $battlepokemon[$key]['battle_health'] *= 2;}
×
×
  • Create New...