Current location: Hot Scripts Forums » Programming Languages » PHP » Having a problem with else statements


Having a problem with else statements

Reply
  #1 (permalink)  
Old 03-04-09, 01:15 AM
Ristick Ristick is offline
Newbie Coder
 
Join Date: Mar 2009
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Having a problem with else statements

I'm not sure what I'm doing wrong. Please help me, it's my first PHP site.
Quote:
<?
if ( $plyrname == "" ) {
echo '<form action="login.php" method="post" name="login" HSPACE=0 VSPACE=0 BORDER=0>
<B>Username : </B><input type="text" size="12" maxlength="10" name="usr" class="fieldsetheadinputs" />
<input type="hidden" name="action" value="process">
<BR><b>Password : </b><input type="password" size="12" maxlength="10" name="pwd" class="fieldsetheadinputs" />
<BR /><center><input NAME="submit" TYPE=image VALUE="Login" SRC="images/Login.jpg" ALT="logout" WIDTH="60" HEIGHT="21">
<BR><a href="create.php" onClick="return GB_showFullScreen(\'create a player\', this.href)"><img src="images/Register.jpg" border="0"></a></center>
</form>
</fieldset>';
}
else
echo "<center>";
echo display_ava_profile($plyrname);
echo "<BR>";
echo $plyrname;
echo "<br>";
echo money($winnings);
echo "</center>";
?>
If you're not sure what I'm doing. I'm trying to have a login box, then when you're signed in, it displays your profile picture, and name, and how much money you got (Poker site)
Problem I'm getting is the blank image, and random MySQL text is coming up. How do I hide the else statement until it's necessary? :S
Reply With Quote
  #2 (permalink)  
Old 03-04-09, 02:26 AM
dgreenhouse's Avatar
dgreenhouse dgreenhouse is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: San Francisco
Posts: 457
Thanks: 0
Thanked 3 Times in 3 Posts
I assume the following is what you're trying to accomplish:
(You have a construct error in around the else clause)

<?
if ( $plyrname == "" ) {
echo '<form action="login.php" method="post" name="login" HSPACE=0 VSPACE=0 BORDER=0>
<B>Username : </B><input type="text" size="12" maxlength="10" name="usr" class="fieldsetheadinputs" />
<input type="hidden" name="action" value="process">
<BR><b>Password : </b><input type="password" size="12" maxlength="10" name="pwd" class="fieldsetheadinputs" />
<BR /><center><input NAME="submit" TYPE=image VALUE="Login" SRC="images/Login.jpg" ALT="logout" WIDTH="60" HEIGHT="21">
<BR><a href="create.php" onClick="return GB_showFullScreen(\'create a player\', this.href)"><img src="images/Register.jpg" border="0"></a></center>
</form>
</fieldset>';
} else {
echo "<center>";
echo display_ava_profile($plyrname);
echo "<BR>";
echo $plyrname;
echo "<br>";
echo money($winnings);
echo "</center>";
}
?>
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
login, roles problem dbrook007 ASP.NET 10 11-10-06 03:42 PM
Form Display Problem neevrap02 Visual Basic 1 09-05-06 05:18 AM
Problem with if statements filth PHP 1 08-04-05 09:18 PM
Count problem kasic ASP.NET 1 10-20-04 12:23 AM
Asp and Microsoft Access 2002 problem gop373 ASP 2 10-06-04 09:13 AM


All times are GMT -5. The time now is 08:29 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.