Jump to content

seanlim

Members
  • Posts

    355
  • Joined

  • Last visited

Everything posted by seanlim

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" /> <head> <script type="text/javascript" src="https://www.google.com/jsapi"></script> <script type="text/javascript"> google.load("jquery", "1.7.1"); </script> <script type="text/javascript"> $("document").on('submit', 'form.response', function() { var $form = $(this); var $wall = $form.closest('.wall'); $.ajax({ type: "POST", url: "include_wall_front/updatecomment_ajax.php", data: $form.serialize(), success: function(){ $("<li>a bunch of code</li>").appendTo('ul', $wall).hide().fadeIn(); } }); return false; }); $(document).ready(function(){ var comment_insert_msg = 'Make a comment...'; $('.comment_insert').on('blur', function(){ if(this.value == ''){ this.value = comment_insert_msg; } }).on('focus', function(){ if(this.value == comment_insert_msg){ this.value = ''; } }).val(comment_insert_msg); }); </script> </head> <body id="thetrue1"> <a href="">test</a> <div class="wall"> <ul> .... </ul> <form class="response" method="post" action=""> <input type="hidden" name="action" value="commentupdate" /> <input type="hidden" name="commentviewedID" value="$PostUserID" /> <input type="hidden" name="commentID" value="$CommentmainID" /> <input type="hidden" name="user" value="$user" /> <input type="hidden" name="userID" value="$user_ID" /> <input type="hidden" name="PostID" value="$PostID" /> <input type="hidden" name="UserPostID" value="$CommentUserID" /> <input type="text" class="comment_insert" name="commentinsert" size="100" /> <input type="submit" value="Go" /> </form> </div> </body> </html>
  2. One of your variables used in the header function has a newline character. It's probably a good idea to run all your variables through urlencode before adding them to the url anyway, that should prevent the error.
  3. I don't think this can be achieved by PHP alone. As you mentioned, in the normal case, it will look for a folder (a file would probably do too). If that fails, your server will probably throw a 404 error without calling any of your PHP scripts. Therefore, I think a PHP-only solution doesn't exist. However, this can definitely be accomplished using a .htaccess file and a RewriteRule.
  4. You might want to look at the range() function too http://www.php.net/manual/en/function.range.php
  5. Hi there, welcome to our forums! You can, indeed, use a JOIN. Since you are trying to combine values from two different rows into a single row, you will have to (INNER) JOIN wp_bp_xprofile_data with itself ON the column user_id. Also, to prevent the postcode field from being "joined" to the other field_ids (other than the username field which you are interested in), you will have to specify which field_id (in this case1) you want it to join to. Your SQL portion will look something like that (untested): FROM postcodes a, postcodes b, wp_bp_xprofile_data c JOIN wp_bp_xprofile_data d ON c.user_id=d.user_id AND d.field_id=1 WHERE a.outcode = '"$postcode"' AND b.outcode = c.value
  6. Please make use of the code tags! This is more of a jQuery question anyway, since you've had all the PHP figured out. You don't assign anything to the val() function; instead, pass the value to the function. i.e. $(obj).val('some value'); Also, you don't need the if conditional which serves no purpose and is probably syntactically wrong too. <!DOCTYPE html> <html> <head> <script type="text/javascript"> $(document).ready(function() { $("#getPIN").click(function(){ <?php $char = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVW XYZ1234567890'; $generated_password = substr(str_shuffle($char), 0, 10); ?> var genNumber = '<?php echo $generated_password; ?>'; $("#txtpin").val(genNumber); return false; }); }); </script> </head> <body> <input type = "text" name = "txtpin" id = "txtpin" value = ""> <input type = "button" name = "getPIN" id = "getPIN" value = "getPIN"> </body> </html>
  7. I, for one, have understood what you want from the start, and have nicely given you the solution: If you do not understand what I posted, simply ask nicely and I will elaborate. I don't know if you have asked for help outside of this thread, but it's no use venting your frustrations here. If you are not getting the help you want (for free) in this forums, suck it up. We don't owe you answers. Having cleared that up, I was suggesting placing the "post-printing" portion of your code in the while loop as such: while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { printf("<h2>#%s</h2>", $row["id"], $row["name"]); echo "<br /><div class=\"comment_gravatar left\"><img alt=\"\" src=\"http://photos-b.ak.fbcdn.net/hphotos-ak-snc6/229186_219276548101072_100000561868489_827154_8135363_n.jpg\" height=\"32\" width=\"32\" /></div><p>Posted By $name<br><br /><p>$message</p><br></div><div class=\"clr\"></div></div>"; } I don't know where/how your $name and $message fields are populated, but you will have to make sure that the appropriate values are assigned to them within the while loop for each post, so that the message is different below each ID.
  8. You missed out the echo: var url = 'get_results.php?data=<?php echo $_GET['data']; ?>&search='+v; If there are any errors in IE with Firefox/Chrome not throwing up any errors, I believe it's cos of its own quirks... What version are you using?
  9. How are you accessing the GET data? The JS seems right, so this is more of a PHP problem actually
  10. var_dump($sql) after building each query. use mysql_error to get the error message from mysql. And I think you will have to use a period (.) instead of commas to join your SQL string. Please also use the code tags for us to read your code more easily.
  11. Try opening up the mp3 file in a text editor, and you will probably see some error message inside?
  12. You are printing the IDs in the a while loop which loops over all the results of the table, so I would expect the stacked IDs to be the output. If you intend to print only 1 ID for 1 post on the page, narrow down your mysql query to select only the relevant ID. If you intend to print 1 ID for each post on the page, include the post-printing code within the while loop as well, to ensure that on each iteration of the loop, the ID is printed once together with the post.
  13. This is no longer a Javascript problem... var_dump($id_to) on the first page and see if the id is correct before you submit the form. Has $_POST worked on your server before? Is messageSent.php manipulating $_POST in anyway before you var_dump($_POST)?
  14. Sorry, i meant: for (i = 0; i < goals[i].length; i++) the square brackets came out as italics
  15. In messageSent.php, you will be able to access the contents of 1. the message through $_POST['message']. 2. the ID through $_GET['id']. Do those work? Otherwise try var_dump($_POST); var_dump($_GET); in messageSent.php and post the output here
  16. Are you sure your for loop is correct? for (i = 0; i < goals.length; i++) Is the second statement supposed to be i<goals.length? I have no idea what is in "goals" since I don't have your PHP script's output... Does the alert/console log in the for loop fire? What's the output?
  17. Simply add action="/messageSent.php" to the <form> element
  18. I've never used facebox, but I don't think it's right to have 2 elements with the same ID. Defeats the entire purpose of IDs IMO, and can cause these kinda unexpected stuff to happen. IDs were never meant to be duplicated!
  19. Edit: oh wait, just realised your key isn't in consecutive order. Anw, you can also achieve that using css and the :nth-child(odd) selector
  20. It depends on what you want to do. If you want to allow users to post tags, then don't use strip_tags which will remove tags. htmlentities and htmlspecialchars will simply convert some of those characters to their character entities, making them safe to print to your page
  21. If you simply commented out that element, you will have to find references to that element in the page's javascript code, and comment out those lines of code too. But you will have to know what you are doing and understand how that element affects any other elements on the page, or you will probably make a mess out of everything and screwing up the functionality of something else on the page.
  22. strip_tags and htmlentities/htmlspecialchars
  23. So... you uncommented the nrRooms element? or did you delete everything and it somehow works now? And why would you want to delete the code from the HTML source? If you do so, you will have to edit your javascript correspondingly as all the elements that the script references will no longer exist.
  24. Great... so that snippet was from the prototype framework?! There's nothing wrong with it, only the values that you pass to it. $('nrRooms') is returning null because you commented out that element in the HTML source
  25. can you try: alert($("[id=freetext]").length); just to see if there are actually multiple elements on the page with id="freetext"?
×
×
  • 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.