1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

php problem, please help.

Discussion in 'PHP' started by apg1985, Jan 21, 2009.

  1. #1
    Hi guys,

    Ive got a select box (select1) which has values 100, 200, 300 etc up to 1000. Below that is another select box (select2) with yes and no, if you select yes it takes 10% away from from the figure the user selected.

    What I need to do now is if the figure is less than 500 the figure is just 50 but if its greater then 500 it stays the same. I've done the code below but all it does is put 50 in the input box no matter what you choose.

    if ($_POST ["select2"] == "yes") {$select1 *=0.9;}
    if ($_POST ["select1"] <500) {$select1 = 50;}
    if ($_POST ["select1"] >500) {$select1 = $select1;}

    <input name="inputbox" value="<?php echo $select1 ?>" />
     
    apg1985, Jan 21, 2009 IP
  2. Colbyt

    Colbyt Notable Member

    Messages:
    3,224
    Likes Received:
    185
    Best Answers:
    0
    Trophy Points:
    210
    #2
    Colbyt, Jan 21, 2009 IP