setting variable eqaual to code script

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • skeeterbug

    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($_SESS ION['cust'])) {

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

    } else {

    print NL . NL;
    }
    $customer->AddDataPart("N ew 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"=>"di splayForm",
    "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.

  • steve

    #2
    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($_SESS ION['cust'])) {
    >
    > print 'You entered: ' . $_SESSION['cust'] . NL . NL;
    >
    > } else {
    >
    > print NL . NL;
    > }
    > $customer->AddDataPart("N ew 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"=>"di splayForm",
    > "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

    Comment

    • porneL

      #3
      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) ;}

      Comment

      Working...