Jump to content

Jessica

Staff Alumni
  • Posts

    8,968
  • Joined

  • Last visited

  • Days Won

    41

Everything posted by Jessica

  1. something1 and something2 are keys of the array at the [0] key of your first array. There is no [0][1]. It'd be [0]["something1"]. The foreach would have to be two levels deep, a foreach within a foreach, unless you do the foreach ON array[0], instead of array.
  2. Look at the lines around that one and make sure syntax is correct. In the future, post just the relevant section, not all the code. While this is not WP specific, you might have better luck in the third party forum because this is so heavy on WP code. Did you make this widget?
  3. Amen. Of course, one site I'm on even allows me to respond via email. I still go use the site for it's intended purpose. Unless the ENTIRE point of your site is messaging, then sending the full message via email will not discourage users from visiting the site for the main purpose.
  4. Is a 4 byte file even going to be a valid image? I'd think that might cause GD to fail.
  5. Ah, I see what you want now. You should do a preg_match I think, to find the case insensitive matches, then parse them to replace with the case sensitive new values.
  6. You didn't do the final else of the if else statement.
  7. You'd need to store the number of times to show the form in a session/hidden input. Then check if it's greater than 0. If it is, show a form and decrement it. When it hits 0, move on. Since you have many forms you need to keep storing the results in the session or in hidden inputs (unless you process it each time and add it to your DB or whatever you're doing with it)
  8. You'd have to put the data into a form with hidden inputs, then post that.
  9. That is completely different from your first post. And what you're saying now doesn't make any sense.
  10. Are you asking how to do a for loop? <?php for($i=0; $i<$x; $i++){ //code } ?>
  11. While I don't agree with the reasoning behind this, here's a function. <?php $string = 'aaaaaaabbbcccccccddddeeeeeeeeee'; function compactString($str){ $chars = array(); for($i=0; $i<strlen($str); $i++){ $c = $str[$i]; if(!isset($chars[$c])){ $chars[$c] = 0; } $chars[$c]++; } $newStr = ''; foreach($chars AS $c=>$v){ $newStr .= $v.$c; } return $newStr; } $newStr = compactString($string); echo $newStr; ?> Output: 7a3b7c4d10e
  12. I'd start with the first line, then go from there.
  13. So when you echo the file name, wrap it in an html link. Do you know how to make a link in HTML?
  14. When you submit the form, the entire page gets processed again, which means that $row['name'] will have a different value, since you're doing it randomly. Make the name of the form field (of which you have two, you only need it once), something like id, whatever your primary key is. Then for the value of the hidden input you'd do $row['id']. Yes, you were right, I apologize. The original way he has it is checking for the literal string - but changing it to your way won't work, because the value of $row['name'] will likely be different, due to the random factor.
  15. That will do nothing. That would check if a form field with the literal name of $row[name] had been sent. What he's doing is giving the fields the name of the pokemon. He needs to instead make the name something static like "pokemon_id" and use the id of the value, then check if $_POST['pokemon_id'] is set.
  16. When you list the files, surround the name in a link to the file, using the <a href=""> tag in HTML. Post your code if you're stuck.
  17. You are trying to access $row in a situation where it hasn't been set (the $_POST check). Turn on all error reporting, and give the form fields a static name so you know what to expect.
  18. Not according to the code you've posted.
  19. Please use code tags. When you call it in the switch statement, you'll need to pass the argument.
  20. It will have to be specific to your site, that is the sort of thing you have to write the code for rather than copy from an example. What don't you understand about what you've read?
  21. Agreed. OP, check the rest of the code. And as suggested run the query in phpMyAdmin or similar.
×
×
  • 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.