xampp on winxp (problem)

Problems with the Windows version of XAMPP, questions, comments, and anything related.

xampp on winxp (problem)

Postby fs » 28. April 2006 21:05

Help, some simple php & html program don't work normal in xampp

example:

calcule.html
<form action="bcalcule.php" method="post">
<input type="text" name="za" value="0">
<br>
<select name="acalc">
<option selected>+</option>
<option>-</option>
<option>*</option>
<option>/</option>
</select>
<br>
<input type="text" name="xa" value="0">
<br>
<input type="submit" name="ans" value="ok"><input type="reset" name="reset" value="reset">
</form>

bcalcule.php
<?
$a_acalc="+";
$b_acalc="-";
$c_acalc="*";
$d_acalc="/";

$acalc=$_POST['acalc'];
if($acalc==$a_acalc){
$va = $za + $xa;
echo "answer is $va";
} if($acalc==$b_acalc){
$va = $za - $xa;
echo "answer is $va";
} if($acalc==$c_acalc){
$va = $za * $xa;
echo "answer is $va";
} if($acalc==$d_acalc){
$va = $za / $xa;
echo "answer is $va";
}
?>


I know that my source code is right, but in xampp I get always answer 0
fs
 
Posts: 4
Joined: 28. April 2006 20:39

Postby Wiedmann » 28. April 2006 21:21

I know that my source code is right,

No ;-)

Make a "error_reporting(E_ALL);" at the top of your script and you can see that you have undefined variables.
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby fs » 28. April 2006 21:43

I have problem with varibles, I get some values in html file and php file must understand it.
I can write

<?
$a = 4;
echo "$4";
?>
and it work in xampp, when I get value from html files, my program don't work in xampp
fs
 
Posts: 4
Joined: 28. April 2006 20:39

Postby fs » 28. April 2006 21:47

xampp don't report any errors or warning, when I runing this program in xampp local host
fs
 
Posts: 4
Joined: 28. April 2006 20:39

Postby fs » 28. April 2006 21:56

sorry I do mistake with this scripts
<?
$a = 4;
echo "$4";
?>

I mean

<?
$a = 4;
echo "$a";
?>

I just tested this script, what I show you(calcule.html and bcalcule.php) . It work wrong, but don't have errors or warning
fs
 
Posts: 4
Joined: 28. April 2006 20:39

Postby Wiedmann » 28. April 2006 23:20

It work wrong, but don't have errors or warning

You have add the line I told you?

BTW:
when I get value from html files, my program don't work in xampp

Please read the PHP manual about "external variables".
Wiedmann
AF Moderator
 
Posts: 17102
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 132 guests