hiding/showing problem

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
ex247
Forum Commoner
Posts: 34
Joined: Tue Oct 28, 2003 1:35 am
Location: Boston, MA, USA
Contact:

hiding/showing problem

Post by ex247 »

this is the code im using to show if the person is "user":

Code: Select all

<?
if (!is_user())
	{
 print "<TR><TD CLASS='td_label'>Problem Starts: &nbsp;&nbsp;</TD><TD>$problemstart</TD></TR>" ;
 print "<TR><TD CLASS='td_label'>Problem End: &nbsp;&nbsp;</TD><TD>$problemend</TD></TR>" ;
 }
 ?>
and the variable for $problemstart and $problemend are:

Code: Select all

$problemstart = "$_POST[frm_year_problemstart]-$_POST[frm_month_problemstart]-$_POST[frm_day_problemstart] $_POST[frm_hour_problemstart]:$_POST[frm_minute_problemstart]:00$_POST[frm_meridiem_problemstart]";
		$problemend   = "$_POST[frm_year_problemend]-$_POST[frm_month_problemend]-$_POST[frm_day_problemend] $_POST[frm_hour_problemend]:$_POST[frm_minute_problemend]:00$_POST[frm_meridiem_problemend]";
but its not showing up when its printed... its just showing blank... and clues?
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Post by kendall »

ex247,

Im not expert but lets do some process of elimination here....

try use the syntax

Code: Select all

$problemstart = $_POST["frm_year_problemstart"].'-'.$_POST["frm_month_problemstart"].'-';
note my quotes!!!! unless frm_year_problemstart is a $var
usually somtimes when variables are in 'quotes' when echoing a string the variable is literally outputted as a string. so if you actually get '$_POST["frm_year_problemstart"]' it could be a reason....

but you said its showing up blank???

next thing to is to see what version of php you have

Code: Select all

echo phpversion();
cant remember if this is the php function to check for the version but if its not > 4 you mite wanna use $HTTP_POST_VARS[ instead of $_POST

can't think of any other reasons as your query is a bit vague...mite wanna try details and may an example and a sample code for further dubuggin

Kendall
User avatar
nick2
Forum Contributor
Posts: 118
Joined: Fri Jul 25, 2003 2:34 pm

Post by nick2 »

isn't it

<?
phpinfo()
?>

tells you everything including the version at the top.
ex247
Forum Commoner
Posts: 34
Joined: Tue Oct 28, 2003 1:35 am
Location: Boston, MA, USA
Contact:

Post by ex247 »

PHP Version 4.3.3

and um...

Code: Select all

$problemstart = "$_POST[frm_year_problemstart]-$_POST[frm_month_problemstart]-$_POST[frm_day_problemstart] $_POST[frm_hour_problemstart]:$_POST[frm_minute_problemstart]:00$_POST[frm_meridiem_problemstart]"; 
      $problemend   = "$_POST[frm_year_problemend]-$_POST[frm_month_problemend]-$_POST[frm_day_problemend] $_POST[frm_hour_problemend]:$_POST[frm_minute_problemend]:00$_POST[frm_meridiem_problemend]";
is fine, i know my code is messye, but it displays find if i dont have it on the

Code: Select all

if(!is_user())
then it works find, like if i dont print it, its wierd that only when i do a print it does that.
User avatar
kendall
Forum Regular
Posts: 852
Joined: Tue Jul 30, 2002 10:21 am
Location: Trinidad, West Indies
Contact:

Post by kendall »

nick2,

yes it is but i just wanted to check the version no need to go trhough all that drama

ex247,

uhhmm...gonna have to break done into english man...

but what your saying is that the code prints out when its not in the 'if' loop?

but doesnt when is in the 'if' loop?

well then lets look at the if
what is the is_user function?

it looks like its not returning a correct answer..lets have a look at it shall we

Kendall
Post Reply