Jump to content

Adam

Moderators
  • Posts

    5,717
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Adam

  1. Try this.. <?php // array defined here $key = array_search('Pink', $cds); if ($key !== false) { foreach ($cds[$key] as $cd) { $matchedCDs[] = $cd; } } print_r($matchedCDs); ?> A
  2. Playing with it a little more there are a few features of reg ex 'not yet implemented' .. if they can work those out though, be' top notch! A
  3. Check that link. There's something on one of them that opens Google, perhaps you could change that slightly? A
  4. Google it .. Just a popular script. It's made for images but I believe you can mod it for your own needs.. sounds similar to what you're saying! Look at this page, might find what you're looking for: http://miniajax.com/ A
  5. Hmm that's odd? Never had a problem like that... What browser are you using?
  6. Try something like: $key = array_search('something', $_POST); A
  7. http://www.strfriend.com/ A
  8. Fair enough, but then again you can have such complex syntax as: ${$a[1]} and: ${$a}[1] with just plain old variables.. Isn't ${1}1 just so that the trailing 1 will be treated as a literal? A
  9. Hah boy do I feel foolish! Though I would still consider them variables being as they represent...variable data?
  10. Sounds a bit like "light box" .. A
  11. genericnumber1: In preg_replace() $1, $2, etc. are valid variables that can be used within the replacement parameter.. http://uk3.php.net/manual/en/function.preg-replace.php Also: $test = 'value'; echo 'test: $test'; ...will still produce "test: value" .. jaymc: Quite fine to use $1, $2, etc but I'm not sure you can use them to call another function from within preg_replace?? You need to remove the single quotes from the arrays though, unless you have created them that way? $data['1'] = 'foo'; // valid way to do it but.. print $data[1]; // ... won't work! print $data['1']; // .... will! $data[2] = 'bar!'; // valid way to do it but.. print $data['2']; // ... won't work! print $data[2]; // ... will! Remember 1 != '1' .. I'm not saying this will definitely work though.. A
  12. Sorry I misread your question slightly before... Can you post your actual code? Also how many rows are pulled from that database (roughly)? Just that $var is going to be overwritten every time your 'while' makes a loop and it could just be that the last record returned is simply empty! A
  13. Can you explain it a little more clearly? Do you mean to kinda 'unset' $var after the loop for re-use? .. or do you mean to carry the data out of the loop, for use later on? A
  14. http://www.phpfreaks.com/forums/index.php/topic,95433.0.html A
  15. Far better than before! Does have the simplistic look too it. Pretty much the only thing I don't like, and this is a little picky, is the outer glow on the Canadian flag symbol.. Nothing else has one so it stands out a little from the rest of the page. Get it coded! A
  16. Either in the JS as you call the 'ajaxpage' function, or in the PHP as you load each page, you'll need to update the cookie to the new page... A
  17. Hah sorry.. Do you mean something more like: foreach ($_POST as $val) { if (substr($val, 0, 5) == 'format') { $str .= (strlen($val) == 6) ? substr($val, 5, 1) : substr($val, 5, 2); } }
  18. var currentUrl = document.location.href; Does this help? A
  19. <?php $i = 1; while ($data = mysql_fetch_array($result)) { $id = $data[0]; $section = $data[1]; $value = $data[2]; $image = $data[3]; ?> <img src="../<?php echo $image; ?>" /><br /> <?php echo $value; ?><br /> <input type="checkbox" name="format<?php echo $i; ?>" value="<?php echo $value; ?>" id="format<?php echo $i; ?>"/> <?php $i++; } ?> A
  20. Waah? Database? Sorry I had no idea this was what you were trying to achieve. I simply rewrote the code you had in the onfocus and onblur attributes... As cytech says..
  21. Jeez, not with it today. Get what you mean now: var page = document.cookie.match(/page=[\w][\w\-\.]+;/); if(page != null) { ajaxpage(page, "content); } else { ajaxpage("default", "content"); } A
  22. Sorry my bad, I didn't realize 'default' was a reserved name! <script type="text/javascript"> <!-- function defaultValSwitch(obj, def, e) { var val; if (e == 'onfocus') { val = (obj.value == def) ? '' : obj.value; } else { val = (obj.value == '') ? def : obj.value; } obj.value = val; return; } //--> </script> A
  23. Try this: <script type="text/javascript"> <!-- function defaultValSwitch(obj, default, e) { var val; if (e == 'onfocus') { val = (obj.value == default) ? '' : obj.value; } else { val = (obj.value == '') ? default : obj.value; } obj.value = val; return; } //--> </script> <input name="customerRef" type="text" class="fields" id="customerRefField" onfocus="defaultValSwitch(this, 'i.e ITA001', 'onfocus');" onblur="defaultValSwitch(this, 'i.e ITA001', 'onblur');" value="i.e ITA001" size="25" /> Note that I've switched onclick to onfocus! A
  24. Post the code as you have it... A
  25. I've posted a solution in the other topic that got moved! A
×
×
  • 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.