
Alex
Staff Alumni-
Posts
2,467 -
Joined
-
Last visited
Everything posted by Alex
-
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 ([ ]).
-
Well the function only returns the array produced, so you shouldn't see any output. print_r(multidimArrayLocate($haystack,$needle));
-
Yeah, that is the problem. If you want to leave out those parameters just leave them blank. $conn = new XMPP('talk.google.com', 5222, '[email protected]', 'pappu617', 'xmpphp', 'gmail.com');
-
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.
-
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.
-
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.
-
You must be using the selector incorrect, so it's not returning the proper element. Can you post your HTML and what statusid contains?
-
What are you asking?
-
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()},
-
You were actually missing that in two places. You fixed it in your gameOver function, but not in your updateScore function.
-
You're missing a semicolon. var score = (snakeLength - 3)*10;
-
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?
-
See this topic: http://www.phpfreaks.com/forums/index.php/topic,296624.msg1404840.html
-
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.
-
Dir Path, folders with names starting with n issue.
Alex replied to JMair's topic in PHP Coding Help
Escape \n with a backslash ( \ ). -
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
-
$_GET['page'] isn't always going to be defined. You should be doing something like: $nav = isset($_GET['page']) ? $_GET['page'] : null;
-
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.
-
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){ ?> ...
-
When stuck always consult the documentation http://api.jquery.com/jQuery.ajax/
-
Try this: data: {content3: test3, votime: test4},