Jump to content

IIS can't handle Optional checkbox POST


kool_samule

Recommended Posts

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:

PHP Notice: Undefined index: jobadminquote in C:\Inetpub\XX\XX\XX\XX\scripts\CompleteQuoteSingle.php on line 65 PHP

Line 65:

$adminoverride = $_POST['jobadminquote'][$rowid]);

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>";
            }
    }
}
?>

 

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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.