This topic is locked
[SOLVED]

 Cant get value form text field

6/2/2012 11:19:53 AM
PHPRunner General questions
S
scoobysteve author

Hi if I run this code on after successful logon it works
if($data['Video3'] >= 200)

{

header("Location: tblproperties_list.php");

}

else

{

header("Location: Profile_list.php");

}
exit();
However if I try to check another field for a value that contains text it always goes for the same option even if the field is empty BTW the MySQL Field for the text is varchar 255

and both fileds are in the same table that is used for the logon details.
if($data['AddImage6'] = "") Is this wrong here I need top check to see if the field value is empty or with no text

{

header("Location: tblproperties_list.php");

}

else

{

header("Location: Profile_list.php");

}
exit();

C
cgphp 6/2/2012
if(empty($data['AddImage6']))

{

header("Location: tblproperties_list.php");

}

else

{

header("Location: Profile_list.php");

}

exit();
S
scoobysteve author 6/2/2012


if(empty($data['AddImage6']))

{

header("Location: tblproperties_list.php");

}

else

{

header("Location: Profile_list.php");

}

exit();



Thanks but this returns the same result each time when the field has a value in it or if its empty

its a varchar 255 field thats shows NULL in phpmyadmin when i browse the data in fields that are empty

and a image file name when they are populated like fatbob12082012.jpg
I actually want to score the member and add a entry to another field if they have a image in this ADDImage field

but no matter what I try it always returns the same value

C
cgphp 6/3/2012
if(is_null($data['AddImage6']))

{

header("Location: tblproperties_list.php");

}

else

{

header("Location: Profile_list.php");

}

exit();
S
scoobysteve author 6/4/2012


if(is_null($data['AddImage6']))

{

header("Location: tblproperties_list.php");

}

else

{

header("Location: Profile_list.php");

}

exit();



Thanks, This still points to the first option on both occasions when I logon to a members account that has a filename listed in the database under ADDImage6 and when there is no filename in the database.

this seems to be the problem I am having with what ever variations of code used it always goes to the same choice.

S
scoobysteve author 6/7/2012



Thanks, This still points to the first option on both occasions when I logon to a members account that has a filename listed in the database under ADDImage6 and when there is no filename in the database.

this seems to be the problem I am having with what ever variations of code used it always goes to the same choice.


Can anyone help with this its crazy no matter what I use it always goes to the same option. I really need to know if the field has a value in it or not and chose a option based on that criteria. Thanks again in advance Steve

C
cgphp 6/7/2012
if(!isset($data['AddImage6']) || trim($data['AddImage6'])==='')

{

header("Location: tblproperties_list.php");

}

else

{

header("Location: Profile_list.php");

}

exit();
S
scoobysteve author 6/7/2012


if(!isset($data['AddImage6']) || trim($data['AddImage6'])==='')

{

header("Location: tblproperties_list.php");

}

else

{

header("Location: Profile_list.php");

}

exit();



Thanks again for this, but its doing the same as before, going to the same option in both instances when there is a file name in ADDImage6 and when there is not.

I am trying this exact code in the After successful logon event.

C
cgphp 6/7/2012

Make a print_r() of $data['AddImage6'] in the After successful login event and let us know what you get.

S
scoobysteve author 6/7/2012



Make a print_r() of $data['AddImage6'] in the After successful login event and let us know what you get.


Sorry how do I do that I tried adding
print_r() of $data['AddImage6'] but it fails to load
Thanks

Steve

C
cgphp 6/7/2012
print_r($data['AddImage6']);
C
cgphp 6/7/2012

Just tested on my local project and the code above works fine. I have set a field to empty and NULL as well.

S
scoobysteve author 6/7/2012



Just tested on my local project and the code above works fine. I have set a field to empty and NULL as well.


Thanks I have just added that code to the after successful login event and after I logon it goes to the menu page, where am I meant to see the result from the print, or is it meant to actually print this off to a printer because I am not seeing anything, sorry

C
cgphp 6/7/2012

Try this:

print_r($data['AddImage6']);

exit();


I have tested the if statement in my local project and it works fine.

S
scoobysteve author 6/7/2012

OK Its working now thank you so much I will try it with my options now once again thank you
Steve

C
cgphp 6/7/2012

Are you sure AddImage6 is the real name of the field? Please, check carefully: it might be addImage6 or Addimage6 or addimage6 for example.