Jump to content

Ingolme

Moderator
  • Posts

    14,897
  • Joined

  • Last visited

  • Days Won

    176

Everything posted by Ingolme

  1. $_SESSION is an array, but unless you tell it to be, $_SESSION['buy'] is not an array. The root of your problem is in this loop. You're only taking the data from one single product and printing it twice. $_SESSION['buy'] doesn't change its value at any point. while($x<2){$product['title'][$x] = $_SESSION['buy'][0];$product['price'][$x] = $_SESSION['buy'][1];$product['img'][$x] = $_SESSION['buy'][2];echo"".$product['title'][$x]."<br />".$product['price'][$x]."<br />".$product['img'][$x]."<br /><br />";$x++;}}else{echo"fail";} Perhaps you need to add an extra level in your array. $data = array();$data[0] = $p_title;$data[1] = $p_price;$data[2] = $p_img;$_SESSION['buy'][] = $data; -----while($x<2){ $product['title'][$x] = $_SESSION['buy'][$x][0]; $product['price'][$x] = $_SESSION['buy'][$x][1]; $product['img'][$x] = $_SESSION['buy'][$x][2];
  2. OK, have you checked that a exists? alert(a);
  3. If you're using Firefox, press Control+Shift+J to open the error console. Is this code in a function? You'll need to execute the code after the postal code has been written using an event handler.
  4. If you're using a location header you should save the session data using session_write_close(). Did you forget to initialize $_SESSION['buy'] as an array?$_SESSION['buy'] = array(); session_start();$_SESSION['pid'] = $s;$_SESSION['buy'][0] = $p_title;$_SESSION['buy'][1] = $p_price;$_SESSION['buy'][2] = $p_img;session_write_close()header("location: index.php?p=shop");
  5. Really? What happens when you try to code?Be sure to check the error console. And it would help if you post your updated code here.
  6. What do the first few lines of your code look like now?
  7. If I'm remembering correctly, the text content should be all the text from the node and all its descendents, whitespace included.
  8. In this case, x is a string. On each iteration of the loop more content is added to the end of the string. x = (x + "string") means that you're adding more content to the value of x and then assigning that value to x.
  9. No, the two bars are actually one of the mistakes in your expression. Have you read my post? One of the problems is that you're outputting "Correct" when the postal code is wrong.
  10. Ingolme

    Mailto

    I don't think that can be done with Javascript. It looks like a browser option.
  11. Ingolme

    Modify Text files

    You now have to query the database and print out the results, of course. You're not actually writing to a text file, just generating one.
  12. I think this might be part of the problem:AC||AE||AH You have a ! operator here, this means that the postal code is correct if the expression is not matched:!a.match(postalcodes)
  13. I'd be glad to see a CSS selector that could select the <body> element that a hovered <a> element belongs to.
  14. They just need to look at the source code to find the part that gets executed after comparing the password. Or, if you want to go the long way around, just copy the hashed password and comparing it directly with what is in the code.
  15. Unfortunately, I can't explain that. It seems like instructions being sent to the printer from the browser.
  16. Ingolme

    hide image url

    It sounds like you might have some unnecessary spaces or line breaks at the end or the middle of the file. readfile() should be the very last thing in your code, and there shouldn't be any spaces or line breaks anywhere else either. Keep all your code inside a single <?php ?> block and make sure that it's on the very first line of the document and that there aren't any blank lines after it.Save the file as UTF-8 without BOM.
  17. Because the comma indicates another argument for the echo command and PHP_EOL is the PHP constant to be echoed.
  18. HTML 5 does not require the type attribute anymore. The W3C has delared ECMAScript as the only standard scripting language for browsers.The <script> tag without the type or language attribute has always worked. The only problem was that it was invalid HTML.
  19. That is Javascript. http://www.w3schools.com/jsref/met_win_print.asp
  20. Is this in your web host? If so, you're just going to have to find another web host.
  21. Get rid of the extra <?php ?> blocks and then see where the error is.Something before line 8 is causing the problem.
  22. You should condense all those separate <?php ?> blocks into one. It will make debugging easier.Like this: <?php$image = intval($_GET['id']);;include 'includes/db.php'$con = mysql_connect($host,$username,$password);if (!$con) { die('Could not connect: ' . mysql_error()); } First problem: extra semi-colon here: $image = intval($_GET['id']);;Missing semi-colon on this line: include 'includes/db.php'
  23. In your CSShttp://www.egtours.com/10_days_nepal_trip.phpLine 70 ul { font-size: 16px;
  24. I notice you're making redundant connections. mysql_connect() only needs to be done once on each page. Anyways, have you tried the code to see if it works? At a glance I don't see anything particularily wrong with it.
  25. The first part of your code is trying to access the value of $row['category'] before you even queried the database.
×
×
  • Create New...