Jump to content

Greaser9780

Members
  • Posts

    326
  • Joined

  • Last visited

    Never

Posts posted by Greaser9780

  1. If it helps here is the file that shows the first dropdown:

    <html>
    <head>
    
    
    
    <script src="selectuser.js"></script>
    </head>
    <body>
    <div align="center">
    <form>
    <select name="users"  onchange="showUser(this.value)">
    <option>QB
    <option>WR
    <option>RB
    <option>TE
    <option>K
    <option>DF
    </select>
    </form>
    </div>
    <div id="txtHint"> </div>
    </BODY>
    </html>

     

    And here is the js file:

    var xmlHttp
    
    function showUser(str)
    { 
    xmlHttp=GetXmlHttpObject()
    if (xmlHttp==null)
    {
    alert ("Browser does not support HTTP Request")
    return
    } 
    var url="showUser.php"
    url=url+"?q="+str
    url=url+"&sid="+Math.random()
    xmlHttp.onreadystatechange=stateChanged 
    xmlHttp.open("GET",url,true)
    xmlHttp.send(null)
    }
    
    function stateChanged() 
    { 
    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
    { 
    document.getElementById("txtHint").innerHTML=xmlHttp.responseText 
    } 
    }
    
    function GetXmlHttpObject()
    {
    var xmlHttp=null;
    try
    {
    // Firefox, Opera 8.0+, Safari
    xmlHttp=new XMLHttpRequest();
    }
    catch (e)
    {
    //Internet Explorer
    try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    }
    return xmlHttp;
    }
    

  2. <?php
    $q=$_GET["q"];
    include("db.php");
    
    
    
    $sql="SELECT name FROM players  WHERE position='".$q."' ORDER BY name ASC";
    
    $result = mysql_query($sql);
    ?>
    <html>
    <head>
    </head>
    <body>
    
    <form action="select.php" method="post">
    Comment:<input type='text' name='com' maxlength='80'><br>
    <select name="playername">
    <?php
    while($row = mysql_fetch_array($result))
    {
      echo "<option value='" . $row['name'] . "'>" . $row['name']."</option>" ;
    
      }
    ?>
    </select>
    <input type="submit" name="submit" value="select">
    </form>
    
    </body>
    </html>
    

     

    At first I thought it was an AJAX issue but it's showing what it is supposed to show. The preceding script is what it is supposed to show. If I take out the "q" part it works fine. So I am wondering why Q is not passed in IE but it is in firefox.

  3. I'm not a huge AJAX guy I just started learning. One thing I know from PHP though, I don't even see a need for you to be using php to show any of that. Why not just use html?

    <HTML>
    <HEAD>
    <TITLE>The Angry Dragon</TITLE>
    <script src="jsFunctions.js" language="javascript" type="text/javascript"></script>
    <script src="ajax.js" language="javascript" type="text/javascript"></script>
    </HEAD>
    
    <BODY BGCOLOR="#FFFFFF" onLoad="javascript:mainOnLoad();">
    <CENTER>
    <FONT COLOR="#000000"><H1></H1></FONT>
    <TABLE WIDTH=85% BORDER=1>
      <TR>
    <TD WIDTH=20% VALIGN=TOP><TABLE BORDER=1 WIDTH=100%><TR><TD WIDTH=100% VALIGN=TOP><DIV NAME=leftFrame ID=leftFrame></DIV><TD></TR></TABLE></TD>
    <TD WIDTH=60% VALIGN=TOP><TABLE BORDER=1 WIDTH=100%><TR><TD WIDTH=100% VALIGN=TOP><DIV NAME=centerFrame ID=centerFrame></DIV><TD></TR></TABLE></TD>
    <TD WIDTH=20% VALIGN=TOP><TABLE BORDER=1 WIDTH=100%><TR><TD WIDTH=100% VALIGN=TOP><DIV NAME=rightFrame ID=rightFrame></DIV><TD></TR></TABLE></TD>
      </TR>
    </TABLE>
    <CENTER>
    </BODY>
    </HTML>

    Add to that all of the table and td declarations should be in ""

  4. Here is the .js file:

    var xmlHttp

     

    function showUser(str)

    {

    xmlHttp=GetXmlHttpObject()

    if (xmlHttp==null)

    {

    alert ("Browser does not support HTTP Request")

    return

    }

    var url="http://www.blah.com/blah/showUser.php"

    url=url+"?q="+str

    url=url+"&sid="+Math.random()

    xmlHttp.onreadystatechange=stateChanged

    xmlHttp.open("GET",url,true)

    xmlHttp.send(null)

    }

     

    function stateChanged()

    {

    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")

    {

    document.getElementById("txtHint").innerHTML=xmlHttp.responseText

    }

    }

     

    function GetXmlHttpObject()

    {

    var xmlHttp=null;

    try

    {

    // Firefox, Opera 8.0+, Safari

    xmlHttp=new XMLHttpRequest();

    }

    catch (e)

    {

    //Internet Explorer

    try

      {

      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");

      }

    catch (e)

      {

      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");

      }

    }

    return xmlHttp;

    }

     

  5. NOPE

    Page sending I have this now:

    if ($actsum < 20){

    $sql1 =mysql_query("SELECT name FROM `draft_teams` ORDER BY activate ASC, teamid DESC LIMIT 1");

    $res1=mysql_fetch_array($sql1);

    $name1=$res1["name"];

    $pd=$res1['pd'];

    $id=$res1['teamid'];

     

     

    header("Location: http://www.BLAH.com/mocks/functions.php/?id=".$res1['teamid']);

    exit();

     

    }  

     

    Accepting page I have this:

     

    <?php

    include("db.php");

    $id=$_GET['id'];

     

     

    echo $id ;

     

     

    It's redirecting properly. If I change $id to "BLAH" it shows up. I can't figure out why it's not sending the value of $id

  6. I am wondering how to go about this in PHP. I need to write a script that constantly detects which teams turn it is. Then if they have preselected players for their team it will update the db the second it becomes their turn. Everytime a teams selection is made it has to check for this and either update or exit. The problem is, if it updates, it automatically needs to run again because it was just updated. Not lookin fo rcode here just suggestion on how to make it happen. I thought of a CRON job but that will not be automatic as I can only run a CRON every minute.  This is how I determine turn as of now. In the teams table I have a row labelled activate every time this team picks a player activate is incremented. So I run a query to return a list of teams ordered by activate ASC then by teamid ASC.

     

     

    I am not sure if this is even possible with only PHP.

  7. Tried <option selected></option>  and it still always uses the last dropdown mox and tries to input a blank value in my table. I think the problem with this setup is all the dropdown still exist they are just hidden. Eventhough they are hidden they still hold data. That's why I went with the other script I posted under.

  8. Here is my select box that calls the js:

    <html>

    <head>

    <script src="selectuser.js"></script>

    </head>

    <body>

    <form>

    <select name="users" onchange="showUser(this.value)">

    <option>QB</option>

    <option>WR</option>

    <option>RB</option>

    <option>TE</option>

    <option>PK</option>

    <option>DF</option>

    </select>

    </FORM>

    <div id="txtHint"> </div>

    </BODY>

    </html>

     

    Here is the java:

    var xmlHttpfunction ;showUser(str)

    {

    xmlHttp=GetXmlHttpObject()

    if (xmlHttp==null)

    {

    alert ("Browser does not support HTTP Request")

     

    }

    var url="getuser.php"

    url=url+"?q="+str

    url=url+"&sid="+Math.random()

    xmlHttp.onreadystatechange=stateChanged

    xmlHttp.open("GET",url,true)

    xmlHttp.send(null)

    }

     

    function stateChanged()

    {

    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")

    {

    document.getElementById("txtHint").innerHTML=xmlHttp.responseText

    }

    }function GetXmlHttpObject()

    {

    var xmlHttp=null;

    try

    {

    // Firefox, Opera 8.0+, Safari

    xmlHttp=new XMLHttpRequest();

    }

    catch (e)

    {

    //Internet Explorer

    try

      {

      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");

      }

    catch (e)

      {

      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");

      }

    }

    return xmlHttp;

    }

     

     

     

    Here is what it is supposed to show:

    <?php

    $q=$_GET["q"];

    require("db.php");

     

    $sql="SELECT * FROM players WHERE position = '".$q."'";

     

    $result = mysql_query($sql);

    ?>

    <html>

    <head>

    </head>

    <body>

    <form action="select.php" method="post">

    Team name:<input type='text' name='name'>

     

    Password:<input type='password' name='pass'>

     

    Comment:<input type='text' name='com' maxlength='80'>

     

    <select name="playername">

    <?php

    while($row = mysql_fetch_array($result))

    {

      echo "<option value='" . $row['name'] . "'>" . $row['name'] . "</option>";

     

      }

    ?>

    </select>

    <input type="submit" name="submit" value="select">

    </form>

    </body>

    </html>

     

     

     

    Any clues why I keep getting these errors

  9. Here is my select box that calls the js:

    <html>

    <head>

    <script src="selectuser.js"></script>

    </head>

    <body>

    <form>

    <select name="users" onchange="showUser(this.value)">

    <option>QB</option>

    <option>WR</option>

    <option>RB</option>

    <option>TE</option>

    <option>PK</option>

    <option>DF</option>

    </select>

    </FORM>

    <div id="txtHint"> </div>

    </BODY>

    </html>

     

    Here is the java:

    var xmlHttpfunction ;showUser(str)

    {

    xmlHttp=GetXmlHttpObject()

    if (xmlHttp==null)

    {

    alert ("Browser does not support HTTP Request")

     

    }

    var url="getuser.php"

    url=url+"?q="+str

    url=url+"&sid="+Math.random()

    xmlHttp.onreadystatechange=stateChanged

    xmlHttp.open("GET",url,true)

    xmlHttp.send(null)

    }

     

    function stateChanged()

    {

    if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")

    {

    document.getElementById("txtHint").innerHTML=xmlHttp.responseText

    }

    }function GetXmlHttpObject()

    {

    var xmlHttp=null;

    try

    {

    // Firefox, Opera 8.0+, Safari

    xmlHttp=new XMLHttpRequest();

    }

    catch (e)

    {

    //Internet Explorer

    try

      {

      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");

      }

    catch (e)

      {

      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");

      }

    }

    return xmlHttp;

    }

     

     

     

    Here is what it is supposed to show:

    <?php

    $q=$_GET["q"];

    require("db.php");

     

    $sql="SELECT * FROM players WHERE position = '".$q."'";

     

    $result = mysql_query($sql);

    ?>

    <html>

    <head>

    </head>

    <body>

    <form action="select.php" method="post">

    Team name:<input type='text' name='name'><br>

    Password:<input type='password' name='pass'><br>

    Comment:<input type='text' name='com' maxlength='80'><br>

    <select name="playername">

    <?php

    while($row = mysql_fetch_array($result))

    {

      echo "<option value='" . $row['name'] . "'>" . $row['name'] . "</option>";

     

      }

    ?>

    </select>

    <input type="submit" name="submit" value="select">

    </form>

    </body>

    </html>

     

     

     

    Any clues why I keep getting these errors.

  10. I was using INSERT now() + INTERVAL 5 MINUTE

    Since I added the -57600 it appears to be working properly. I am only showing hours,minutes, seconds though

    Now I am having trouble getting the cronjob timer to work right since it never displays a negative number. I change the CRON script to if $disp >300 <-----number of seconds in 5 minutes. The timer should stay close to 5 minutes

×
×
  • 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.