Jump to content

Alex

Staff Alumni
  • Posts

    2,467
  • Joined

  • Last visited

Everything posted by Alex

  1. By the way, you shouldn't use { } to access characters in a string, this is depreciated as of PHP 5.3.0, instead use square brackets ([ ]).
  2. Well the function only returns the array produced, so you shouldn't see any output. print_r(multidimArrayLocate($haystack,$needle));
  3. Yeah, that is the problem. If you want to leave out those parameters just leave them blank. $conn = new XMPP('talk.google.com', 5222, 'bi.dw.architect@gmail.com', 'pappu617', 'xmpphp', 'gmail.com');
  4. Something like this should work: echo '<form action="" method="post"> <table width="100%"> <tr> <td><textarea rows="1" cols="40" name="comment'.$row['id'].'" id="comment'.$row['id'].'"></textarea></td> </tr> <tr> <td style="text-align:right;"> <input type="submit" id="'.$row['id'].'" name="postcomment" class="postcomment" value="Comment" /> </td> </tr> </table> </form>'; $(function() { $(".postcomment").click(function() { var commentid = $(this).attr('id'); if(commentid == '') { // ?? alert("Please Enter id"); } else { if($('#comment' + commentid).val() == '') { alert("Please Enter Some Text"); } else { $("#flash"+statusid).slideDown("slow").html('<span class="loading">loading</span>'); $.ajax({ type: "POST", url: "update_comment.php", data: data: {statusid: commentid, content: $("#comment"+commentid).val()}, cache: false, success: function(html){ $("div#commentdisplay"+statusid).prepend(html); $("div#commentdisplay"+statusid).slideDown("slow"); document.getElementById('content').value=''; document.getElementById('content').focus(); $("#flash"+statusid).hide(); } }); } } return false; }); }); I didn't alter the line with the slideDown(), or the stuff in the success callback, so you'll need to edit that accordingly. But that should give you an idea.
  5. I understand that, but what I'm talking about is this: <input type="hidden" value="'.$row['id'].'" name="statusid" id="statusid" /> That element is also repeated without a unique id and it's what you're using to get the id for the comment, which won't work because there are multiple elements with that same id/name.
  6. You said that block of HTML is looped over and over? That means there will be multiple declarations of elements with the id/name of statusid containing different values.
  7. You must be using the selector incorrect, so it's not returning the proper element. Can you post your HTML and what statusid contains?
  8. One thing I noticed right away is this: var boxval = $("#comment".statusid).val(); Should be: var boxval = $("#comment"+statusid).val(); But as far as I can see there's no reason to store that in a variable. First you should check to make sure the variables hold what you're expecting. data: {statusid: $("#statusid").val(), content: $("#comment"+statusid).val()},
  9. You were actually missing that in two places. You fixed it in your gameOver function, but not in your updateScore function.
  10. You're missing a semicolon. var score = (snakeLength - 3)*10;
  11. Not entirely sure what you're trying to do. Can you post an example of the element you're trying to match with that selector?
  12. See this topic: http://www.phpfreaks.com/forums/index.php/topic,296624.msg1404840.html
  13. That should be another parameter, like so: $.ajax({ url: 'mypage.php', data: {act: 'something'},
  14. That would put the contents of the output in all elements of class "result".
  15. You can find a good tutorial that covers the fundementals of AJAX here. If you're using a JavaScript library like jQuery, YUI, etc.. many of them include easy ways to implement AJAX. If you want to use JQuery you can look here for some good examples on how to use AJAX in JQuery.
  16. You can't execute PHP like that at all. PHP (PHP: Hypertext Preprocessor) is, as its name implies, only a preprocessor. Meaning that PHP is executed on the server side, only, and the output of that is sent to the browser. You simply can't embed PHP in JavaScript function. JavaScript is so widely supported these days it's really not important to consider about the extremely small percentage of people browsing the web that might not have JavaScript support. If I recall correctly, the statistics were estimated at under 5% several years ago. What you're looking for is AJAX (which isn't what you explained at all). The variables that you wish to submit and validate would be sent via the HTTP request made through AJAX. Your PHP script can then validate these variables and send the response back to JavaScript where the appropriate action can be taken.
  17. From what I understand what you're attempting to do is impossible. Can you elaborate?
  18. You should not be using session_register in the first place. It's depreciated as of PHP 5.3.0. Instead use $_SESSION session_start(); $_SESSION['var'] = 'val'; session_start
  19. $_GET['page'] isn't always going to be defined. You should be doing something like: $nav = isset($_GET['page']) ? $_GET['page'] : null;
  20. Not sure if you've already looked at the facebook developer documentation, but if not you can probably the find the answer to your question(s) here.
  21. You never closed off the first block of PHP. <?php include("usersetup.php"); $filename = "onlineusers.html"; $html = ""; if (!file_exists($filename) or filemtime($filename) < time() - 1){ ?> ...
  22. When stuck always consult the documentation http://api.jquery.com/jQuery.ajax/
  23. Try this: data: {content3: test3, votime: test4},
×
×
  • 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.