Jump to content

Need help in working with Class/Object using PHP/HTML


navjak

Recommended Posts

Hi Guyz!!

 

Iam New to PHP and trying to generate a report for my project.

Iam using php5.1.4 and Apache Server 2.0.

I dont know where I have gone wrong and facing problem in executing the script. I could et the HTML output where the user can select his choice of report but the php script is not getting executed fully. I have attached my script below. All I could get is the echo statements at the begining of the php script. Iam not able to execute the script which is inside the class and functions.

 

Please help me in this.

 

Regards,

Jaknav.

 

Iam calling the file name in the browser.

File Name: ABC.php

 

 

<html>

  <body>

      <form action="<?php $PHP_SELF; ?>" method="post">

        <table border="0" align="center" cellpadding="5" cellspacing="0">

            <tr>

              <td align="right" valign="middle">BuildName:</td> 

  <td>

      <select name="BuildName">

                    <option value="CRM89">CRM89</option>

          <option value="CIS88">CIS88</option>

                  </select>

  </td>

</tr>

<tr>

    <td align="right" valign="middle">BuildType:</td>

  <td>

      <select name="BuildType">

                    <option value="STD">STANDARD</option>

                    <option value="CODE">Code</option>

                  </select>

              </td>

          </tr>

        </table>

        <input type="submit" />

    </form>

 

<?php

  set_time_limit(0);

  set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) .

  DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "ScoobySnacks");

  echo "include path = " . get_include_path() . "\n";

  require_once("ScoobyScheduler.php");

 

  class ScoobyBuildTypeAverageTime extends ScoobyScheduler {

 

      function BuildTypeAverageTime() {

 

Statements 1

          .

.

N

 

$BuildName=$_POST['BuildName'];

$BuildType=$_POST['BuildType'];

 

echo "Build Name is {$_POST['BuildName']}";

echo "Build Type is {$_POST['BuildType']}";

                 

          if (!$this->BuildTypeAvgTimeByWeek($this->BuildClasses[$p],$BuildName,$BuildType)) {

            return false;

          }

 

          if (!$this->BuildTypeAvgTimeByMonth($this->BuildClasses[$p],$BuildName,$BuildType)) {

            return false;

          }

 

          if (!$this->BuildTypeAvgTimeByYear($this->BuildClasses[$p],$BuildName,$BuildType)) {

            return false;

          }

        } 

        return true;

      }

       

function BuildTypeAvgTimeByWeek($BuildClass,$BuildName,$BuildType) {

Statements 1...n}

 

function BuildTypeAvgTimeByMonth ($BuildClass,$BuildName,$BuildType) {

Statements 1...n}

function BuildTypeAvgTimeByYear ($BuildClass,$BuildName,$BuildType) {

Statements 1...n}

} # End of Class

 

 

$SBATObject = new ScoobyBuildTypeAverageTime("BuildTypeAverageTime");

  if ($SBATObject->rc > 0) {

      echo "Error constructing object SBATObject. Exiting.\n";

      exit(1);

  }

 

  $SBATObject->BuildTypeAverageTime();

  $SBATObject->Scooby->Log->WriteSectionHeader(Date("H:i:s") . " Finished", "Mediumpurple");

 

?>

 

  </body>

</html>

 

 

This sounds like a PHP problem to me. Your HTML looks fine and wouldn't have anything to do with why your PHP classes aren't working properly. You should repost <a href="http://www.phpfreaks.com/forums/index.php/board,1.0.html" title="here">here</a>.

Thanks buddy!!

 

I solved it. Its a configuration issue. Added two lines in httpd.conf

AddType application/x-httpd-php .htm

AddType application/x-httpd-php .html

 

It worked. I was able to execute the functions. I have one more issue.

 

If you see my HTML code I have hardcoded the option values. Now I want to connect to the database and fetch values from the DB to the combo boxes.

Can anyone help me in writing the code. I am using Oracle DB.

 

Thanks & Regards,

Navjak.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.