You could try something less convoluted like:

<?php if ($u != "x"): ?>
<put code here>
<?php endif; ?>

<?php if ($u != "y"): ?>
<put code here>
<?php endif; ?>

<?php if ($u != "z"): ?>
<put code here>
<?php endif; ?>

NOTE:  the code between the IF and ENDIF will not be visible unless the
condition equates to TRUE
-----Original Message-----
From: Steve Jackson <[EMAIL PROTECTED]>
To: PHP General <[EMAIL PROTECTED]>
Date: Monday, October 28, 2002 8:14 AM
Subject: [PHP] Displaying one of three functions.


>I have three functions written which work and I want to only display one
>of them depending on user input.
>What is the correct way to code this?
>I can display all three functions but not one.
>
>this is my code:
>
><?
>
>  include ('products_sc_fns.php');
>  // The shopping cart needs sessions, so start one
>  session_start();
>
>  do_html_header("Checkout");
>  // if filled out
>  if($cart&&$name&&$address&&$city&&$zip&&$country)
>
>  {
>    // able to insert into database
>    if( insert_order($HTTP_POST_VARS)!=false )
>    {
>      file://display cart, not allowing changes and without pictures
>      display_cart($cart, false, 0);
>   calculate_weight($cart);
>   file://de-bug
>   file://echo "test & $country & $express";
>
>   display_shipping(calculate_shipping_cost($weight));
>   display_shipping(calculate_nonfinland_cost($country));
>   display_shipping(calculate_express_cost($express));
>   file://display_shipping(calculate_temp_shipping_cost($weight));
>      file://get credit card details
>   calculate_final_cost($total_price, $shipping);
>   get_order_id();
>   display_card_form($name, $final_cost);
>    echo "<table width='760' cellpadding='0'
>background='images/shopbg.gif'><tr><td width='200'>&nbsp;</td>";
>       echo "<td align='right'>";
>      display_button("show_cart.php", "continue-shopping", "Continue
>Shopping");
>    echo "</td></tr></table>";
>    }
>    else
>    {
>  // error info and footer goes here.
>
>
>I want to display shipping if the user is from finland and paying an
>express cost
>display_shipping(calculate_express_cost($express));
>
>from finland but paying by weight of shipping
>display_shipping(calculate_shipping_cost($weight));
>
>or from outside of finland
>display_shipping(calculate_nonfinland_cost($country));
>
>How do I write the If statement to say if country=finland&express=yes
>display function 1
>then if country = finland but express="" display function 2 or if
>country isn't finland do 3?
>
>Tried all morning and repeatedly failed!
>
>
>Steve Jackson
>Web Developer
>Viola Systems Ltd.
>http://www.violasystems.com <http://www.violasystems.com/>
>[EMAIL PROTECTED]
>Mobile +358 50 343 5159
>
>
>
>
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to