For Programmers: Free Programming Magazines  


Home > Archive > PHP Smarty Templates > September 2004 > $smarty->assign problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author $smarty->assign problem
John Nichel

2004-09-13, 8:57 pm

Hi list,

I have this bit of code below, and I'm pulling my hair out because of
it. Basically, I'm trying to assign a value if a certain form variable
is posted. However, the $smarty->assign ( "foo", "bar" ); inside of
that first if statement does not do anything (it does echo out 'yes', so
I know the if statement is being executed). The second if statement (if
1 == 1) works fine, and smarty sets that variable with value, as does
the last $smarty->assign which isn't in an if statement. It's driving
me crazy...can anyone shed some light on why the $smarty->assign in the
first if statement may not be working? TIA.


if ( isset ( $_POST['customzip'] ) && is_numeric ( $_POST['customzip'] ) ) {
if ( is_array ( $userinfo ) ) {
$userinfo['s_zipcode'] = $_POST['customzip'];
} else {
$userinfo = array (
"s_zipcode" => $_POST['customzip']
);
}
$smarty->assign ( "foo", "bar" );
echo ( "yes" );
}
if ( 1 == 1 ) {
$smarty->assign ( "earth", "world" );
}
$smarty->assign ( "bob", "bob" );

--
John C. Nichel
ÜberG
KegWorks.com
716.856.9675
john@kegworks.com
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com