Jump to content

Recommended Posts

if you notice there is 2 echo.. one is before if and another is inside if statement .. the before if statement will echo the $Username2 value and ...the echo inside the if statement will not echo the $Username2 value ... the $Username2 is pass from a .php to this .php form how to make the value is available inside the IF statement ? pls advice

 

<?php
$Username2=$_POST['username'];
//echo $Username2;
if (isset($_POST['enter']))
{
echo $Username2;
$year  = $_POST['select'];


echo $year;
echo $myrow["Year"];
$Year = $myrow["Year"];

$query2="SELECT * FROM transaction where Year = $year";

cant also .. the variable only can be display outside the if ... this is some code from login

 


if (mysql_num_rows($result) == 1) {
	// the user id and password match, 
	// set the session
	$_SESSION['db_is_logged_in'] = true;

	// after login we move to the main page
	header('Location: transaction.php');
	exit;
} else {
	$errorMessage = 'Sorry, wrong user id / password';
}

include 'library/closedb.php';
}
?>
<html>
<head>
<title>Basic Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php
if ($errorMessage != ' ') {
?>
<p align="center"><strong><font color="#990000"><?php echo $errorMessage; ?></font></strong></p>
<?php
}
?>
<form action="transaction.php" method="post" name="frmLogin" id="frmLogin">
<table width="400" border="1" align="center" cellpadding="2" cellspacing="2">
  <tr>
   <td width="150">Username</td>
   <td><input name="username" type="text" id="username"></td>
  </tr>

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.