Connecting Tech Pros Worldwide Help | Site Map

setting variable eqaual to code script

  #1  
Old July 17th, 2005, 11:47 AM
skeeterbug
Guest
 
Posts: n/a
i have a program that will display a number of diffferent results
depending on the situation.

one example of the code looks like

<?php if(isset($_SESSION['cust'])) {

print 'You entered: ' . $_SESSION['cust'] . NL . NL;

} else {

print NL . NL;
}
$customer->AddDataPart("New Customer Name: <br>");
$customer->AddInputPart("cust");
$customer->AddDataPart("<br>");
$customer->AddInputPart("submit");
$customer->AddInputPart("reset");
$customer->AddInputPart("_submit_check");

unset($_SESSION['cust']);

session_destroy();

}

$error = $customer->Output(array(
"Function"=>"displayForm",
"EndOfLine"=>"\n"
));

?>

i want to assign this code to a variable (other code will be assigned
to the same variable depending on what if/wlse branch it ends up on.

what is the best way to assign this to a variable in such a way that it
will be understood as php when the variable is called in the final
code? do i need multiple include statements for each possible if/else
outcome?

if so, what is the best way to assign an include page to a variable?

tia...

ps - i'm using a forms class here, hence, the code looks the way it
does.

  #2  
Old July 17th, 2005, 11:49 AM
steve
Guest
 
Posts: n/a

re: setting variable eqaual to code script


"jskeith1" wrote:[color=blue]
> i have a program that will display a number of diffferent
> results
> depending on the situation.
>
> one example of the code looks like
>
> <?php if(isset($_SESSION['cust'])) {
>
> print 'You entered: ' . $_SESSION['cust'] . NL . NL;
>
> } else {
>
> print NL . NL;
> }
> $customer->AddDataPart("New Customer Name: <br>");
> $customer->AddInputPart("cust");
> $customer->AddDataPart("<br>");
> $customer->AddInputPart("submit");
> $customer->AddInputPart("reset");
> $customer->AddInputPart("_submit_check");
>
> unset($_SESSION['cust']);
>
> session_destroy();
>
> }
>
> $error = $customer->Output(array(
> "Function"=>"displayForm",
> "EndOfLine"=>"n"
> ));
>
> ?>
>
> i want to assign this code to a variable (other code will be
> assigned
> to the same variable depending on what if/wlse branch it ends
> up on.
>
> what is the best way to assign this to a variable in such a
> way that it
> will be understood as php when the variable is called in the
> final
> code? do i need multiple include statements for each possible
> if/else
> outcome?
>
> if so, what is the best way to assign an include page to a
> variable?
>
> tia...
>
> ps - i'm using a forms class here, hence, the code looks the
> way it
> does.[/color]

use php’s "eval"

--
Posted using the http://www.dbforumz.com interface, at author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbforumz.com/PHP-setting-...ict188595.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbforumz.com/eform.php?p=639932
  #3  
Old July 17th, 2005, 11:49 AM
porneL
Guest
 
Posts: n/a

re: setting variable eqaual to code script


> i want to assign this code to a variable (other code will be assigned[color=blue]
> to the same variable depending on what if/wlse branch it ends up on.[/color]

Why?

This seems like a tip of a mountain of poorly designed code...


--
* html {redirect-to: url(http://browsehappy.pl);}
Closed Thread