Jump to content

Recommended Posts

hi

in a php file I assign a value to a tag. and with it make a condition for mysql command. but when run query  and then using a form for sending some values to a function, all thin is work , but the vale of tag erased.

when i trying to define this tag as global I see below errors.

Parse error:  parse error, unexpected '=', expecting ',' or ';' in C:\Apache2\htdocs\bill\desktop\send_game.php on line 64

Link to comment
https://forums.phpfreaks.com/topic/210716-lost-the-tag-value/
Share on other sites

<?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.

Link to comment
https://forums.phpfreaks.com/topic/210716-lost-the-tag-value/#findComment-1099204
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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