+ Reply to Thread
Results 1 to 4 of 4

Thread: Passing values

  1. #1
    liguehs is offline x10Hosting Member liguehs is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    62

    Passing values

    Hi guys,
    I have a question....
    Ok so I have a page which is called: line-up.php
    So when the users clicks a box, a pop-up opens up and there is a list of players which they can click. So what I want is that, when the users clicks on a name, that name comes into that apppropriate box(which is a table cell).
    And at the end of the page there is a submit button, and when users clicks on it, it updates the MYSQL table.
    The names list is a mysql table output also.....
    I am thinking of using the GET method, but I have no idea what so ever how to pass the url to the parent page lol.


    Thanks for your help,
    Ara
    Edit:
    Oh and, there must be a restriction.

    it is for a hockey league.

    So a team muste have maximum 20 players in their line-up....
    There are differerent Positions.
    Forwards 4 lines of 3 players.
    Defenses 3 lines f 2 players
    Goalie 1 Starting and another Backup


    And there is 2 Power Play Line
    5 Players each
    And 2 Penlaty Kill line
    4 Players each


    But there can only be 18 players in total and 2 goalies...

    Thanks for your help,
    Ara
    Last edited by liguehs; 07-22-2009 at 05:46 PM. Reason: Automerged Doublepost

  2. #2
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Passing values

    How is the page currently structured? Are you using a <form>? Are you using the table for layout or to structure tabular data? What functionality have you already implemented? Specifically, what parts are you having problems with? Please post minimal sample code showing your current design and a link to a live sample page.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  3. #3
    liguehs is offline x10Hosting Member liguehs is an unknown quantity at this point
    Join Date
    Jul 2009
    Posts
    62

    Re: Passing values

    Hi,
    thanks for your intrest.

    Ok so here is the line-up.php
    But it is just a sample page. I am going to put the style after.
    Code:
    <?php
    define('IN_PHPBB', true);
    $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : '../';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);
    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup();
      $user->get_profile_fields($user->data['user_id']);
      $user_team = $user->profile_fields['pf_equipe'];
      $link = mysql_connect ("localhost", "liguehs_ara", "1992arayugi")
      or die("mysql_error()");
      mysql_select_db ("liguehs_league", $link);
        $run_team = mysql_query("SELECT * FROM `teams_numbers`  WHERE `ProName` = '$user_team'",$link);
        $team_name = mysql_fetch_array($run_team) or die(mysql_error());
        $FarmName = "" .$team_name['FarmName']. "";
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
    <HTML>
    <HEAD>
    <TITLE></TITLE>
    <script language="javascript">
    function popup()
    {
    window.open('functions.php?action=chose_line-up_pro&team=<?php echo"$user_team"; ?>', "Message","menubar=1,resizable=1,width=150,height=900");
    }
    </script>
    </HEAD>
    <BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#FF0000" VLINK="#800000" ALINK="#FF00FF" BACKGROUND="?">
    <table border="1" cellspacing="10" width="80%">
     <tr>
      <th width="20%">Ailiers Gauche</th>
      <th width="20%">Centre</th>
      <th width="20%">Ailiers Droit</th>
     </tr>
     <tr>
      <a href="#" OnClick="popup()"><td>&nbsp;</td></a>
      <a href="#" OnClick="popup()"><td>&nbsp;</td></a>
      <a href="#" OnClick="popup()"><td>&nbsp;</td></a>
     </tr>
     <tr>
      <a href="#" OnClick="popup()"><td>&nbsp;</td></a>
      <a href="#" OnClick="popup()"><td>&nbsp;</td></a>
      <a href="#" OnClick="popup()"><td>&nbsp;</td></a>
     </tr>
     <tr>
      <a href="#" OnClick="popup()"><td>&nbsp;</td></a>
      <a href="#" OnClick="popup()"><td>&nbsp;</td></a>
      <a href="#" OnClick="popup()"><td>&nbsp;</td></a>
     </tr>
     <tr>
      <a href="#" OnClick="popup()"><td>&nbsp;</td></a>
      <a href="#" OnClick="popup()"><td>&nbsp;</td></a>
      <a href="#" OnClick="popup()"><td>&nbsp;</td></a>
     </tr>
    </table>
    </BODY>
    </HTML>
    And here the functions.php:
    Code:
    <?php
    $action = $_GET['action'];
    $name = $_GET['name'];
    $team = $_GET['team'];
    $link = mysql_connect ("localhost", "liguehs_ara", "1992arayugi")
    or die("mysql_error()");
    mysql_select_db ("liguehs_league", $link);
    $run_team = mysql_query("SELECT * FROM `teams_numbers`  WHERE `ProName` = '$team'",$link);
    $team_name = mysql_fetch_array($run_team) or die(mysql_error());
    $pro_id = "" .$team_name['ProId']. "";
    $farm_id = "" .$team_name['FarmId']. "";
    mysql_select_db ("liguehs_league", $link);
    if ($action == 'demote'){
    $query = "UPDATE `playersratings` SET Team = '$farm_id'  WHERE Name ='$name'";
    mysql_query($query) or die(mysql_error());
    echo "$name a ete descendu dans l'equipe mineur<br/>";
    echo "<a href='javascript:opener.location.reload()' Onclick='window.close();' > Fermer la fenetre</a>";
    }
    mysql_select_db ("liguehs_league", $link);
    if ($action == 'promote'){
    $query = "UPDATE `playersratings` SET Team = '$pro_id'  WHERE Name ='$name'";
    mysql_query($query) or die(mysql_error());
    echo "$name a ete monte dans l'equipe PRO<br/>";
    echo "<a href='javascript:opener.location.reload()' Onclick='window.close();' > Fermer la fenetre</a>";
    }
    mysql_select_db ("liguehs_league", $link);
    if ($action == 'chose_line-up_pro'){
    echo "<table border='1'>
    <tr>
     <th>Name</th>
     <th>Age</th>
     <th>OFF</th>
     <th>DEF</th>
     <th>OVE</th></tr>";
    $result = mysql_query("SELECT * FROM `playersratings`  WHERE `Team` ='$pro_id' ",$link);
      while($row = mysql_fetch_array($result))
      {
      echo "<tr><td><a href='javascript:opener.document.location = 'line-up.php?name=" .$row['Name']. "' Onclick='window.close();'>" .$row['Name']. "</a></td><td>" .$row['Age']. "</td><td>" .$row['OFF']. "</td><td>" .$row['DEF']. "</td><td>" .$row['OVE']. "</td></tr>";
      }
    echo "</table>";
    }
    ?>
    Edit:
    Up...
    Edit:
    Up..
    Last edited by liguehs; 07-24-2009 at 02:15 PM. Reason: Automerged Doublepost

  4. #4
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Passing values

    Don't worry, I haven't forgotten you. I'm going to post an answer when I get the chance.

    In the meantime, have you been studying the linked pages?
    Last edited by misson; 07-28-2009 at 04:20 AM.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

+ Reply to Thread

Similar Threads

  1. Help with script.
    By stuart1010 in forum Programming Help
    Replies: 19
    Last Post: 06-10-2009, 10:48 PM
  2. Passing a form into a cig script
    By smatt454 in forum Free Hosting
    Replies: 3
    Last Post: 09-04-2008, 08:49 PM
  3. MySQL Issues Here
    By Corey in forum Service Alerts
    Replies: 304
    Last Post: 01-06-2008, 09:10 PM
  4. mysql cc
    By chrisosx in forum Free Hosting
    Replies: 7
    Last Post: 07-06-2005, 01:22 PM
  5. Mod Help
    By Ericsson in forum Free Hosting
    Replies: 4
    Last Post: 03-04-2005, 03:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers