Jump to content

ToonMariner

Members
  • Posts

    3,342
  • Joined

  • Last visited

Everything posted by ToonMariner

  1. it means that the variables you require will have those names - so just use $_GET as you normally do and use those variable names in the second list to reference the correct values. location mapping is where you may get a delimted set of info like yes/no/green/holiday. you could map those into 4 variables using their position in the string... but these guys warn that the order may change so don't use the mapping method.
  2. since for ages! I have not used a named anchor for longer than I can remember. Since there was once a point where the name attribute was marked as deprecated (and recinded I beleive as they forgot how they were gonna tackle radio and option groups) in favour of the id attribute. Name has never been a valid attribute for any tag bar anchor and form elements.
  3. try this <script language="javascript"> function calculateTextBox(textBoxName, maximum){ var str = document.getElementById(textBoxName).value; if(str.length > maximum){ document.getElementById(textBoxName).value = str.substring(0, maximum); }else{ var remaining = maximum - str.length; document.getElementById('text_limit_'+textBoxName).innerHTML = remaining ; } } </script>
  4. if ($pages > $page - 3 && $pages < $page + 3) return;
  5. or <?php $postcode = 'yourstring'; $result = preg_replace('/(.*)?([0-9][a-zA-Z]{2})$/', $1,trim($postcode)) ?>
  6. All post codes end in NUMBER LETTER LETTER so all you need is to strip the last 3 characters and then trim any white space.. <?php $postcode = 'yourstring'; $temp = trim($postcode); $code = substr(($temp, 0 ,strlen($temp) - 3); $code = trim($code); ?>
  7. many email clients do not act anywhere near like a browser. Much to my frustration if you want to send out rich content html emails and have it work 'very similarly' on clients like outlook, incredimal AND the web based ones like hotmail, aol, yahoo, gmail etc. you must use old fashoined table layouts with inline styling and images (not background images as some clients strip them out)
  8. have a look to see if you live server has short tags enabled in the php.ini file.
  9. Have a look @ a pagination tutorial... http://www.phpfreaks.com/tutorials/73/0.php or http://www.phpfreaks.com/tutorials/43/0.php
  10. $file = 'htp://myspace.com'; surely should be $file = 'http://myspace.com';
  11. <?php // would be the function. function secure_int($variable) { return intval($variable); } // would be the script. $id = secure_int($id); echo "Your ID is ".$id."!"; ?> the amazing thing here is that you ave managed to generate a function that does the exact same job as an already avialable built in function AND given it a longer name. if you look at the code you could just do this and get exactly teh same result with a little time saving... <?php echo "Your ID is ". intval($id) ."!"; ?> or (if you use $id more in the script) <?php $id = intval($id); echo "Your ID is ". $id ."!"; ?>
  12. it means 'search the whole string and if you find ASTRING in there return true. // are regular expression delimiters and the ending i means make it case insensitive.
  13. readfile($filepath); should be... readfile($filepath.'/'.$filename); but I am not so sue this will do what you want.... I am just looking around for a pretty good php download script I have. Ill give it you tomorrow if you remember to get in touch.
  14. depends on which version of php you have... <?php $file = 'PATH/TO/FILE'; if (function_exists('file_get_contents')) { $string = file_get_contents($file) } else { $fp = fopen($file,'rb'); $string = fread($fp,filesize($file)); fclose($fp); } if (preg_match('/ASTRING/i',$string)) { echo 'found string'; } ?>
  15. mine is more effcient just noted that you have $_session - make sure you use $_SESSION.
  16. if (isset($_session['username']) && strcmp($_session['username'],'admin') == 0) { } else { }
  17. hmmm that is a surpise even with the number of records...
  18. you should perhaps look at storing a user level with each user adn this turorial is excellent for developing an access level system. http://www.phpfreaks.com/tutorials/151/1.php dont' be put off - read it a couple of times and you will see that its not anywhere near as difficult as you may think initially. (the last page of the turial will show you how you can use it to allow/deny access to pages based on your login.)
  19. I bet the query is still , < 1 second... the problem may be elsewhere...
  20. that is what php and mysql love to do every nanosecond of the day.... it looks like you need an introduction http://www.sitepoint.com/article/mysql-3-getting-started-php
  21. as a security measuer you should never store usernames and passwords in a session. but otherwise seacrh all your code for where these variables are set (easy enough with dream weaver) and see what is happening.
  22. nowt wrong with that... unless you have an old mysql version
  23. position:fixed will keep that div exactly where it is on the page even when you scroll the rest of the page. position: absolute could easily be substitued for float: right for screen media.
  24. If you use a decent doc type declaration then you can place divs exactly where you want. But the answer to your question is both. Use divs to group sections of your page - use tables to display tabular data (and nothing else!) and use css to layout your page as you wish. In actual fact it is far more complicated to manage a page tat uses tables for layout. When it comes to modifying you need to ensure you manage any colspans or rowspans properly AND you need much more markup for a table than a div (it requires at least 3 tags and their associated tags for just one cell - a div is just one open and closing tag.) Pages that have a css layout will (in virtually every case) load faster than its table counter-part.
  25. yes check data before you use it. this is commone with include files, mysql queries or where you use exec(); make sure that you verify data that is going to be used in such cases.
×
×
  • 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.