$_SESSION[''] if statement is printing error [SOLVED]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

$_SESSION[''] if statement is printing error [SOLVED]

Post by tecktalkcm0391 »

I have a page that includes page1.php:

Page1.php
I have this on the included page: (Just put it all together)

Code: Select all

 <input name="username" type="text" id="username" value="

Code: Select all

<?php if(!isset($_POST['reset']) || isset($_SESSION['username'])){   print($_SESSION['username']);  } ?>

Code: Select all

" size="28" maxlength="25" />
And I keep getting this in the textbox:
<br /><b>Notice</b>: Undefined index: username in <b>/home/public_html/register/page1.php</b> on line <b>21</b><br />
Last edited by tecktalkcm0391 on Sun Jul 16, 2006 10:43 am, edited 1 time in total.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Post by Jenk »

use && instead of ||
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

haha. I feel so stupid now. I don't know why i did that. :oops:
Post Reply