Connecting Tech Pros Worldwide Help | Site Map

setting variable eqaual to code script

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 17th, 2005, 10:47 AM
skeeterbug
Guest
 
Posts: n/a
Default setting variable eqaual to code script

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, 10:49 AM
steve
Guest
 
Posts: n/a
Default 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, 10:49 AM
porneL
Guest
 
Posts: n/a
Default 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);}
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.