0

衛星から収集したデータを使用して、形成中の貯水池を更新するために使用されるフォームを作成しようとしています。

作成するphpコードを返しますが、フォームを表示できません。空白のWebページしか表示されません。何が問題なのか。以下の私のコードを参照してください:

 <?php
    $id = $_SESSION['user'];
    include "pgsql.connect.php";
    $text="";   

    $seasonArray = array('Dry','Wet');
    $sateliteDataTypeArray = array('MSS','LANDSAT TM','LANDSAT ETM','JRS','SPOT','ASTER','ALMAZ','IRS','OTHER');

        echo "What!!!";
        $id_query="SELECT * FROM tbl_reservoir";
        $id_result=@mysql_query($id_query,$dbc);
        $text.='<form enctype="multipart/form-data" action="index.php?mod=update_res" method="post">
        <table><tr><td>Reservior ID: </td><td><select id="res_id" name="res_id">
            <option selected></option>'; 
            while ($id_row=@mysql_fetch_array($id_result)) {
                $ids=$id_row['res_id'];
                $text.='<option>'.$ids.'</option>';
            }

        $text.='</select>
        </td></tr>
        <tr><td>Reading Date: </td><td><input type="text" name="reading_date" size="25" maxlength="25" value="" />
        </td></tr>
        <tr><td>Satelite Datatype: </td><td><select id="sat_data" name="sat_data">';
            // For each value of the array assign variable name Satelite Type
                foreach($sateliteDataTypeArray as $sat){
                    $text.='<option>'.$sat.'</option>';}
        $text.='</select></td></tr>
        <tr><td>Dry or Wet Season: </td><td><select id="season" name="season">';
        // For each value of the array assign variable name city
                foreach($seasonArray as $season){
                    $text.='<option>'.$season.'</option>';}
        $text.='</select>
        </td></tr>
        <tr><td>Reservoir Surface Area: </td><td><input type="text" name="surfArea" size="25" maxlength="25" value="" />
        </td></tr>
        <tr><td>Reservoir Volume: </td><td><input type="text" name="resVol" size="25" maxlength="25" value="" />
        </td></tr>
        <tr><td>Reservoir Average Depth: </td><td><input type="text" name="resAvDepth" size="25" maxlength="25" value="" />
        </td></tr>
        </table>
        <div align="center"><input type="submit"
        name="submit" value="Submit" /></div>
        <input type="hidden" name="submitted"
        value="TRUE" />
        </form>';
        //end form creation

    if(isset($_POST['submitted'])) //checks if form submitted
        {
            //assign entered values from the form to variables
            $resID=$_POST['res_id'];
            $dateReading=$_POST['reading_date'];
            $satType=$_POST['sat_data']
            $season=$_POST['season']
            $surfaceArea=$_POST['surfArea'];
            $resVol=$_POST['resVol'];
            $avDepth=$_POST['resAvDepth'];

            //echo $plot.

            $warning='';

            //validate the entered values into the form
            if($dateReading==''||$satType==''|| $season=='' || $surfaceArea=='' || $resVol=='' || $avDepth=='')
                {
                    $warning="<span class='warning'>Please complete all fields.</span>";
                }


            //if (s)he's made an error (one of the above IF statements is true
            if($warning!='')
                {
                    //display the form with some error or warning message(s)
                    $p=new Page('Join us');
                    $p->setHeading('Please complete the form');
                    $p->setContent($text.$warning.$form_text);
                    $p->printIt();
                }
            else
                {

                    //****************** insert satelite data details into SATELITE DATA TABLE *******************************
                        $query="INSERT INTO tbl_volfromsatelite SET res_id='$resID',
                                               reading_date='$dateReading',
                                               res_sat_surfacearea='$surfaceArea',
                                               res_avg_depth='$avDepth',
                                               res_vol='$resVol',
                                               dry_or_wet='$season',
                                               sat_datatype='$satType'";
                        $result=@mysql_query($query,$dbc) or die(mysql_error());
                        //mysql_close($dbc);
                    //********************************************************************************************************
                    if ($result)
                    {
                    //update reservoir details in the Database
                    $q="UPDATE tbl_reservoir SET res_vol='$resVol', res_area='$surfaceArea', res_vol_date='$dateReading' WHERE res_id='$resID'";
                    $r=@mysql_query($q);

                    if(@mysql_affected_rows()==1)
                        {
                            $p=new Page('Update Reservoir Details');
                            $p->setHeading('Update Complete');
                            $p->setContent('The Reservoir details have been updated');
                            $p->printIt();
                        }
                    else
                        {
                            $p=new Page('Update Error');
                            $p->setHeading('Update not successful');
                            $_POST['res_id']='';
                            $p->setContent($text.'The reservoir details could not be updated due to some system error.
                                            <br/> We apolosize for inconvenience <p/>');
                            $p->printIt();
                        }
                    }

                }       

        }
        else
        {
            //display the form
            $p=new Page('Update Reservoir Information');
            $p->setHeading('Please complete the form, <b>all fields are compulsary</b>.');
            $p->setContent($text);
            $p->printIt();
        }

?>
4

0 に答える 0