PDA

View Full Version : How to call $userinfo[textfield] in functions.php when field is from the 'user' TABLE


007
05-26-2003, 09:50 PM
Hi,

I added a field to that is in the user table, and is varchar(20) to an if/else statement in functions.php

It looks like

if ($post[field5]==1 and $userinfo[textfield]!="") {
$image="path to image.gif";} else if ($post[field5]==1) {
$image="path to alternate image.gif";} else {
$image="";}

Is it possible to do this? I am trying to have an image appear in the postbit depending on if a member has certain profile fields selected or filled out...

I have tried $post, $bbuserinfo, and $userinfo in front of the [textfield] in the PHP above and it hasn't worked any of the times.

Is what I am trying to do possible??? Please HELP! :(

filburt1
05-26-2003, 10:27 PM
I don't see anything immediately wrong, but you desperately need to indent correctly. Your code is next to impossible to read...

007
05-27-2003, 01:26 AM
I copied and pasted it from notepad and didn't realise that. Here's a better one...


if ($post[field5]==1 and $userinfo[textfield]!="") {
$image="path to image.gif";
}

else if ($post[field5]==1) {
$image="path to alternate image.gif";
}

else {
$image="";
}


I don't know the exact technical way to align the code but you get the picture.

Is there any reason why this wouldn't work? This is exactly what I am doing and it is not working at all. I placed this code in the functions.php if that helps..

I will try to mess around some more with it but I think there is something I'm missing... :(

007
05-27-2003, 02:52 AM
Got it now. It was an easy fix. Thanks. :)