<?php
if(isset($_POST['add']))
{
send_game();
}
?>
<form action='' method='post'>
<input name='filter' type='submit' id='filter' value='تائيد' />
<select dir="ltr" name="week">
<option value="1">هفته اول</option>
<option value="2">هفته دوم</option>
<option value="3">هفته سوم</option>
<option value="4">هفته چهارم</option>
<option value="5">هفته پنجم</option>
</select>
فيلتر هفته
</form>
<?php $week = get_param($_POST, "week");
<?php
$result = $db->sql_query("SELECT * FROM `billing_game` WHERE `game_week`='$week'" );
while($show_result=$db->sql_fetcharray($result))
{
$result2 = $db->sql_query("SELECT * FROM `billing_results` WHERE (`results_gameid`='{$show_result['game_id']}') AND (`results_userid`='{$_SESSION['SUB_USER_ID']}')");
$show_result2=mysql_num_rows($result2);
if($show_result2 != 0 )
{
$result1 = $db->sql_query("SELECT * FROM `billing_results` WHERE (`results_gameid`='{$show_result['game_id']}') AND (`results_userid`='{$_SESSION['SUB_USER_ID']}')");
$show_result1=$db->sql_fetcharray($result1);
$re_ft = $show_result1['results_firstteam'];
$re_st = $show_result1['results_secondteam'];
$status ="$re_st-$re_ft";
}
else
{
$g=$show_result['game_id'];
$status = "
<form action='' method='post'>
<input name='add' type='submit' id='add' value='ثبت' />
<input name='second_results' type='text' class='results_user_input_text ' id='second_results' />
<input name='first_results' type='text' class='results_user_input_text ' id='first_resultse' />
<input type='hidden' name='game_id' value='$g' />
</form>
";
}
}
echo $msg
function send_game()
{
global $db;
$first_results = get_param($_POST, "first_results");
$second_results = get_param($_POST, "second_results");
$game_id = get_param($_POST, "game_id");
if($first_results == "")
{
$GLOBALS['msg'] = "<font color=red>نتيجه ميزبان وارد نشده است</font>";
}
elseif($second_results == "")
{
$GLOBALS['msg'] = "<font color=red>نتيجه ميهمان وارد نشده است.</font>";
}
else
{
if($db->sql_query("INSERT INTO `billing_results` VALUES (null,'$game_id', '{$_SESSION['SUB_USER_ID']}', '$first_results', '$second_results', '1')"))
{
$GLOBALS['msg'] = "<font color=green>اطلاعات با موفقیت ارسال شد</font>";
}
else
{
$GLOBALS['msg'] = "<font color=red>اطلاعات ارسال نشد</font>";
}
}
}
?>
the value of $week lost.
and I delete some html code from my code for better understanding.