Jump to content

srinivasa

Member
  • Posts

    35
  • Joined

  • Last visited

Posts posted by srinivasa

  1. Here i have attached a file name prime.php ,basically am reading input from a form and check whether no is prime or not....there is problem with code, its really working well for small nos upto 10(user input),if user enter above 10 like 11,100...its showing the following error

    Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\prime.php on line 25

     

    Kindly i request you to have a look at code, n suggest me solution.

    prime.php

  2. Am glad to say i got the answer........code is here

     

    class Calculator

    {

    var $sum;

    var $dif;

     

    function add($number1, $number2)

    {

    $this->sum=$number1 + $number2;

    }

     

    function substract($number1, $number2)

    {

    $this->dif=$number1 - $number2;

    }

    }

     

    $num1=$_POST['no1'];

    $num2=$_POST['no2'];

     

    //Create an object

    $calc = new Calculator();

     

    //Call class methods

    $calc->add($num1,$num2);

    $calc->substract($num1,$num2);

     

    //Display output

    echo "Sum = ".$calc->sum." <br>";

    echo "Difference = ".$calc->dif." <br>";

    ?>

     

     

    now i would like to set initial value using constructor...help me out....

  3. <?php
    class inputs
    {
    var $no1 = $_POST['no1'];
    var $no2 = $_POST['no2'];
    
    function addNos()
    {
    echo $this->no1;
    echo $this->no2;
    $add = ($this->no1) + ($this->no2);
    echo $add;
    }
    }
    $obadd = new inputs();
    $obadd->addNos();
    ?>

  4. thanks ya..that comment line i deleted,but real problem was i missed </form> tag in (username and password form)sessions.php so i rectified the error, and got the desired result........

  5. Here i have attached a file named myAge.php ,basically am reading age from a form ,once i submit the form(just age field is there to fill out) its showing blank page!! give me solution please....

     

    in that session.php(last box is the age form)

    myAge.php

    sessions.php

  6. I have added the following line in four different pages(for ex: session.php,myproduct.php,myage.php,twologout.php)

     

    $_SESSION['pages'] = $_SERVER["REQUEST_URI"];

     

    i want to display all the four uri in one page say history.php tel me how to display,i tried but dint get the answer..........

     

    so plz giv me ur suggestion...thanks in advance

×
×
  • Create New...