Jump to content

JKG

Members
  • Posts

    289
  • Joined

  • Last visited

Everything posted by JKG

  1. it IS strange!! i followed your suggestion and just commented out $mail->Send(); and the cookie is still in tact after sending the form!! any thoughts? thanks, Joe.
  2. Is this true, i have cookies on my site till i send a form which fires off two emails. the cookies are not only deleted, but i can reset the cookie to the proper values unless i delete all my cookies!! any ideas?
  3. thank you so much, worked perfectly! wasnt aware of array_unique()
  4. hello, is there any way that i can take a string like this: 99,99,28,99,28,112,78,99,28,112,78,28,112,78,112,78,112, and find and remove the recurring numbers so i am left with this:? 99,28,112,78 thanks for your time Joe
  5. got it to work with this: <script> function updateTextArea() { var allVals = []; $('.c_b :checked').each(function() { allVals.push($(this).val()); }); $('#t').val(allVals); $.post("script.php",{t:allVals}); } $(function() { $('.c_b input').click(updateTextArea); updateTextArea(); }); </script> THANKS!
  6. this is jquery, still doesnt work. it breaks the inital js. function updateTextArea() { var allVals = []; $('.c_b :checked').each(function() { allVals.push($(this).val()); }); $('#t').val(allVals) $.ajax({ type: "POST", url: "script.php", data: "t=".allVals }); $(function() { $('.c_b input').click(updateTextArea); updateTextArea(); });
  7. ahhh, thats using mootools...
  8. i got that bit of AJAX from here: http://stackoverflow.com/questions/2580229/php-get-value-of-input-box-without-a-form
  9. yes . thanks.
  10. UPDATE: the above script (with added AJAX) does not work...
  11. Thanks MasterACE14, so this is what i have, its not working though... im not too hot with jQuery/AJAX so dummy help would be appreciated. Inital Page: <html> <head> <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"></script> <script type="text/javascript"> function updateTextArea() { var allVals = []; $('.c_b :checked').each(function() { allVals.push($(this).val()); }); $('#t').val(allVals); var r = new Request.JSON({ 'url': 'script.php', 'method': 'post', 'onComplete': function(success) { alert('AJAX call status: ' + (success ? 'succeeded': 'failed!'); }, 'onFailure': function() { alert('Could not contact server'); }, 'data': 't=' + allVals }).send(); } $(function() { $('.c_b input').click(updateTextArea); updateTextArea(); }); </script> </head> <body> <div class="c_b"> <input type="checkbox" name="contact[]" value="2"> <input type="checkbox" name="contact[]" value="5"> </div> <textarea id="t"></textarea> </body> </html> that works. just not the ajax bit... it doesnt send to the script.php which simply contains <?php session_start(); $_SESSION['contact_ids'] = $_POST['t']; $cont_id = $_SESSION['contact_ids']; ?>
  12. hello, i have implemented a jquery function like this: http://jsbin.com/ujuse i need to grab the contents of the textarea to store it in a session, but without sending a form, is this possible?? thanks for looking
  13. I have mod_rewrites in use for a site of mine, i want to just add on the end of some of the pages another variable (for pagination) i cant $_GET['start'] either of these with use of mod_rewrites /supplier-search-results.html&start=30 /supplier-search-results.html?start=30 the actual page is: index.php?page=results the rule is: RewriteRule ^supplier-search-([^/]*)\.html /site/index.php?page=$1 thanks!
  14. hey i have installed lazykarl and it works fine however i have images in accordion style divs, and because they are set to display:none initially, lazykarl does not have any effect on them and they load regardless.. does any one know of a fix or of a tool that will stop all images loading when not in the view port? thanks!!!
  15. using a combination of the above, it would be pretty easy then, instead of a pagination method, to just have a button which says '10 more' and load another ten results not already displayed... thanks for your help guys.
  16. the title sounds quite ridiculous but i dont know how else to put it... i want to return results, but my site has got quite popular, quicker than i would have thought. i want to paginate the results. but i want the results to appear at random. but the results should not appear twice... can this even be done? any questions...? thanks!
  17. duuuurrrrrr. got it. it was because i wasnt entering a postcode so it obviously wasnt going through the if statement. thanks guys... and sorry! Joe.
  18. thanks for your reply. $query_inrange could be anything but will always follow this format: 1, 2, 3, 4, 5, 6, $refine_price ends with AND - that works fine...
  19. i said 2 initially cos i didnt want to write out over 10 fake id's in the inital post. but now you have the source code you can see i may (and do) return over 10 in the postcode match.
  20. well, i want a random 10 of all the values yes. thanks
  21. $query = "SELECT * FROM `users` WHERE {$refine_price} `Level_access`=2 AND `active`=1 AND `business_type` LIKE '%1%' AND `unavailable_dates_array` NOT LIKE '%$trimmed%' AND `unavailable_dates_array` !='' AND ID !='".mysql_real_escape_string($_SESSION['user_id'])."' ORDER BY RAND()"; if($_POST['u_postcode'] != ''): $result = mysql_query($query) or die ("Error ".mysql_errno().": ".mysql_error()."\nQuery: $query"); //this int is to help with the comma spacing later on EDIT LOOK TO LINE 46 //$i = 1; //loop the query while ($row = mysql_fetch_array($result)) { //get the photographers postcode and split it into 2 pieces $p_postcode = explode(' ',$row['address_post_code']); //run the two postcodes throught the function to determin the deistance $final_distance = return_distance($u_postcode[0], $p_postcode[0]); //start the variable so we can add to it later on $photographers_inrange = ""; //declare this variable to help with the comma spacing too EDIT LOOK TO LINE 46 //$i2 = 1; //if the distance is smaller or equal to the distance the photographer covers if($final_distance <= $row['cover_distance']){ //get their id $photographers_inrange .= $row['ID'].','; //EDIT: this method does not work when just one result is returned. now i use substr -1. //if this isnt the last result //if($i++ <= $i2++){ //then add a comma for the sql statement //$photographers_inrange .= ','; //} } //declare the variables the if statement made into one $query_inrange .= $photographers_inrange; } if(!empty($query_inrange)){ //get all fields relating to the photographers that are in range $query = "SELECT * FROM `users` WHERE `id` in (".substr($query_inrange, 0, -1).") LIMIT 10";}else{ //return blank //not very elegant, will work on a solution $query = "SELECT * FROM `users` WHERE `id`=0";}; endif; the limit bit is hardcoded. ps. i know order by rand() is not great, nor is select * thanks.
  22. thanks for looking into this with me. im not sure what you are asking, do you want surrounding code? i declare $query to grab all suitable rows then do a postcode search, which returns the ID's of the rows that are within the postcode area then a redeclare $query with the ids in the stated format: SELECT `name` FROM `users` WHERE `id` in (2, 3, 4, 6) LIMIT 2
  23. SELECT `name` FROM `users` WHERE `id` in (2, 3, 4, 6) LIMIT 2 does not work. it displays all 4. any ideas why or how to make it work? thanks.
  24. do you have to use RegEx?
×
×
  • 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.