IIS can't handle Optional checkbox POST

Discussion in 'PHP' started by koolsamule, Jan 28, 2010.

  1. #1
    Hi Chaps,
    I have a form where a user can edit a quote, when the form is submitted, the info is POSTed to a script file, which processes the information and runs an SQL Query.
    The form has an OPTIONAL edit feature, when selected, POSTs an 'jobadminquote' array to the script.
    My local Apache server can handle the option either ticked or unticked, my live IIS server throws up an error when unticked:
    Line 65:
    Script Code:
    <?php 
    $allowed_tables = Array('table1','table2','table3'); // to prevent SQL injection
    foreach($_POST['quote'] as $var) {
        $arr = explode(':', $var);
        if(in_array($arr[0], $allowed_tables)) {
            $table = $arr[0];
            $rowid = $arr[1];
            $projid = $arr[2];
            $setprice = $_POST['jobquote'][$rowid];
        $adminoverride = $_POST['jobadminquote'][$rowid]);
            if(is_numeric($rowid)){
                if($adminoverride=='y'){
                // Run SQL Query here to update $table where row matches $rowid
                }
                else {
                // Run Something Else
                }
            }
                else {
                $mess = "<p>There was a problem</p>";
                }
        }
    }
    ?>
    Code (markup):
    My question is: is there a way to tell the script to ignore the $adminoverride = $_POST['jobadminquote'][$rowid]); if the $_POST['jobadminquote'] doesn't exist?
     
    koolsamule, Jan 28, 2010 IP
  2. koolsamule

    koolsamule Peon

    Messages:
    101
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    issue sorted: isset()
     
    koolsamule, Jan 28, 2010 IP