Determining if a number is even or odd...

A

Anonymous

Guest
Hi again,

I'm thinking this would be the easiest way to do this, anyhow... but, I could be wrong.

Here's what it's for (to get a better idea):

- I have an include (oakwood-passwords.php) which has usernames/passwords in a multi-dimensional array with '$membername[$i] and $password[$i]...(I know, it's not secure, but it's for a site that has VERY limited, specific viewers.)

- This page is to include the oakwood-passwords.php, look at it and make the member names into a drop-down list and ignore the passwords.

- Next, it's to ask for the password.

- Upon submit, the page afterward will check to make sure that what was entered matches the included oakwood-passwords.php entry. If so, display something... if not, don't display anything.

Here's the code::
Code:
<?
include 'oakwood-passwords.php';
$totalfamilynumber = count($membername);
print
("
<form method=POST action=passcheck.php>
	<table border=1 width=40% id=table1>
		<tr>
			<td width=186>Please choose your name:</td>
		<td><select size=1 name=GivenName></select></td>
            <option selected></option>
");
print ("$membername");
for ($i = 0; $i < $totalfamilynumber; $i++)
(
if ( $i % 2 != 0 )
{
print "<option name=$membername[$i]>$membername[$i]</option>";
}
else
{
}
)
print
("         </select>
		</tr>
		<tr>
			<td width=186>Please give us your password:</td>
			<td><input type=text name=GivenPassword size=10></td>
		</tr>
	</table>
	<input type=submit value=Submit name=B1><input type=reset value=Reset name=B2>
</form>
");
?>

I'm getting a parse error on the 'if' statement line.

This one is a little confusing. If you could give me some assistance, please advise.

Thanks in advance,

B.
 
you can do this i guess:
Code:
$type=$i / 2;
if (gettype($type)=="double")
{
do whatever;
}
 
You're getting a parse error because you're using parentheses -- () -- instead of curly braces -- {} -- for your for block.
 
Back
Top