I've upploade my php codes under the address http://george.freeoda.com, my problem is the calc link located on the http://george.freeoda.com/calc.php, this php files processess successfully on my server locally, what might be the problem?

my full php codes are:

<?php 
$n1 = &$_POST['n1'];  // textbo1 declaration
$n2 = &$_POST['n2'];  // textbo2 declation
   if (isset($_POST['Button'])) {   // check if a button is clicked


    if (isset($_POST['string'])) { 


    $selected_radio = $_POST['string'];
if(is_numeric($n1) && is_numeric($n2)) {   
  switch($selected_radio)  {        
        // a function to count words used in a string enterd  
            case 'minus':
       echo "<font color = 'red'>",$n1, "</font> - " ,"<font color = 'red'>",$n2, "</font> =  ", $n1 - $n2;            
             break;
      case  'devide': 
            echo "<font color = 'red'>",$n1, "</font> / ","<font color = 'red'>" ,$n2, "</font> =  ", $n1 /$n2;     
                   break;
             case 'multiply' :
            echo "<font color = 'red'>",$n1, "</font> * ","<font color = 'red'>" ,$n2, "</font>  =  ", $n1 * $n2;
                   break;
        default:
            echo "<font color = 'red'>",$n1, "</font> + ","<font color = 'red'>" ,$n2, "</font>  =  ", $n1 + $n2;
           } 

        }


       else
        echo "<font color = 'red'>Enter only numbers</font><br>"  ;
       }
    if(empty($n1) && empty($n2)) {
    echo "<font color = 'red'>Fill in First number and Second number</font>";}                  
       }

?>
or follow the link http://george.freeoda.com/calc.txt.

What's wrong with my codes guys?
can someone figure out the problem for me?

Recommended Answers

All 3 Replies

<?php
echo phpinfo();
?>

type phpinfo() and display the result so that we can know what is your server config.
If above code works then it will be sure that php is working in your server and we can check what else might cause this problem.

If you are just submitting the form back to the same page, why not use

action="<?php echo $_SERVER['PHP_SELF']; ?>" >

Also, your form action is submitting to Calc.php which your host doesn't like, probably because of the capital "C".

Thanks foyour advice every thing is now fine

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.