Jump to content

coder71

Members
  • Posts

    17
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

coder71's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Moderator, if you would please delete this post I'd appreciate it. I'm a little lost right now on this. Thanks!
  2. I have a PHP page that makes a checkbox appear after a certain textbox is exited. This part of the functionality is working - the user leaves the textbox, the AJAX call is made, and if certain criteria are met, the checkbox appears or it doesn't. Here's where I need help. When the checkbox appears on the form and the form is submitted via POST, I can't get its value. Here's the code that's in the HEAD section: <script type="text/javascript"> $(document).ready(function() { $('#id2').blur(function(){ $.post("biz/add_official.php", { id1: $('#id1').val(), id2: $('#id2').val() }, function(response){ $('#usernameResult').fadeOut(); setTimeout("finishAjax('usernameResult', '"+escape(response)+"')", 400); }); return false; }); }); function finishAjax(id, response) { /* $('#usernameLoading').hide();*/ $('#'+id).html(unescape(response)); $('#'+id).fadeIn(); } //finishAjax </script> And here's the code that's in the FORM section: <span id="usernameResult" style="color:green;"></span> <script> $('.container').find('.checkOfficial input[type="checkbox"]').val() </script> When the form is submitted via POST, how do I see if checkbox was checked or unchecked? Both of these variables appear empty when the form is submitted: $_POST['checkOfficial'] $_POST['usernameResult']
  3. There are other ways to do this, but this will work. <?php $blnMatch = false; while(($row_FleetE = mysql_fetch_assoc($FleetE) && (!blnMatch)){ if ($row_FleetE['PlanetName'] == 'Mon Calamari'){ $blnMatch = true; echo $row_Fleet['FleetName']; echo' '; }} ?>
  4. Excellent...thanks for the thorough answer!
  5. Also, I'd need the server to handle multiple requests from different games. I thought sockets were on only one port. If that's correct, then would I still be able to use this solution?
  6. Would anything else besides LAMP be needed on the server side? For example, would I need a console app on the server or anything like that? Thanks for all of your input!
  7. By "raw sockets", do you mean WebSockets? If you mean "Sockets," does that work with just PHP?
  8. Hello, Would you recommend WebSockets, SOAP, or some other transmission architecture for the following? I'm developing an online multiplayer (or single player vs the system) game, kind of like "Jeopardy!" in PHP. Users will log on, and if they choose to play against someone else in a different location, then the game will have to know who buzzed in first (clicked on a button on the screen) and instantly notify both players. The game will tell the first player that they buzzed in first, and the other player will instantly know that they they buzzed in after the first person and therefore can't answer. There could be X number of games simultaneously, but each game would have only 1-2 players. Questions would be stored in a MySQL db, as well as player credentials and score histories. Transmission from the server to the client and back would need to be encrypted. Thanks!
  9. Great observations! My illustration with Jeopardy! is somewhat flawed. I would have a question displayed with 4 possible answers, and whoever read and answered first would get the points (or lose points if answered incorrectly) Exactly - the server would have to know who clicked first in order to determine who has the right to answer the question. This would involve either locking out subsequent answers from other players OR displaying a message that someone else buzzed in first. Also, it would have to notify each player if the first buzzed-in player was correct or not. So, is this something I can do with Ajax & PHP?
  10. Hello, I'm thinking of developing a multiplayer game...you can think of it like "Jeopardy!" I know PHP and MySQL very well, and JavaScript somewhat. I have no experience with Ajax. Would it be possible to create a multiplayer (from different computers) Jeopardy-like game with PHP, MySQL, and Ajax that would work well? For example, players in different locations could log on to the site, see a queue of game sessions available, join one, and play. The database would store the questions and record the player's scores at the end of each game. It would be a multi-instance game, where n number of games could be played by n number of players. Traditionally, this sounds like a C++ client-server app (like the online poker games), but I don't know C++ at all. Just wondering if this could be done with PHP, Ajax, and MySQL. Thanks!
  11. No. "Is it feasible" is different from "has it been done." Perhaps I should have said "would it be practical." From what I've gathered, this type of application is normally a client server app in Java. I have no experience with Java, so I was asking if "PHP/Ajax would be a viable alternative to Java for this type of app."
  12. Hello, Is it even feasible to create a multiplayer online poker or bingo site with PHP and AJAX? What type of architecture and programming languages are normally used for apps like that?
  13. oops... i meant to say "What happens is that if everything is verified, it looks like the form posts and for a brief second the submit button disables<b>, but then it re-enables and then</b> the form refreshes without actually posting the data. This is holding me up on completing this project. I've searched everywhere. Can anyone please help me with this?
  14. I've seen the posts on this, but the submit button is still not disabling on my page. The code is supposed to check the form for errors and then disable the submit button. It catches the errors, but won't disable the submit. What happens is that if everything is verified, it looks like the form posts and for a brief second the submit button disables. Then the form refreshes without actually posting the data. Here's the JS in the head: function disableForm(theform) { if (document.all || document.getElementById) { for (i = 0; i < theform.length; i++) { var tempobj = theform.elements; if (tempobj.type.toLowerCase() == "submit") tempobj.disabled = true; } return true; } } function validRequired(formField,fieldLabel) { var result = true; if (formField.value == "") { alert('Please enter a value for the "' + fieldLabel +'" field.'); formField.focus(); result = false; } return result; } function validateForm(theForm){ if (!validRequired(theForm.cardnumber,"Credit Card Number")){ return false; } if (!validRequired(theForm.cardexpmonth,"Expiration Month")){ return false;} if (!validRequired(theForm.cardexpyear,"Expiration Year")){ return false;} disableForm(theForm); return true; } Here's the form line: <form name="addjob3" action="<? PHP_SELF; ?>" method="POST" onsubmit="return validateForm(this)"> Here's the submit button: <input type="submit" name="submitp" value="Submit"> I've been trying this for literally a whole day. I can't get it and it's driving me nuts! I'd really appreciate someone helping me with this. I'm good with PHP but don't know much about JS at all.
×
×
  • 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.