Page 1 of 1

Passing Values

Posted: Sat Jul 25, 2009 10:35 am
by Aravinthan
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.
Oh and, there must be a restriction.
HEre is the coding I have so far:
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: Select all

 
<?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: Select all

 
<?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&#058;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&#058;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&#058;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>";
}
?>
 
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

Re: Passing Values

Posted: Sun Jul 26, 2009 8:59 am
by Aravinthan
UP