PHP Classes

Demo not working

Recommend this page to a friend!

      Biometrics Class  >  All threads  >  Demo not working  >  (Un) Subscribe thread alerts  
Subject:Demo not working
Summary:v1.0 en and fr demo files appear not to run correctly
Messages:3
Author:Bob Squires
Date:2007-10-17 14:22:40
Update:2007-10-18 02:10:37
 

  1. Demo not working   Reply   Report abuse  
Picture of Bob Squires Bob Squires - 2007-10-17 14:22:40
This class looks very useful for some work I am doing soon in a school, but I cannot get the demo files you supplied to work correctly. I uploaded all the files to my web host (Apache) but they do not operate correctly when I run them from my browser. I think the difficulty is with the "Age" code. In Firefox v2 or Opera v9 I get this printed on the screen immediately under the page title text:
"; for($n=1; $n<101; $n++) { $CBage .= "$n"; } $CBage .= ""; ?>
and the age cannot be selected. In IE7 this text is not printed but the overall result is the same.
If I enter size and weight values and click on the "Calculate" button the page redirects to
mysitename/trials/biom/%3C?%20echo% ...
which is obviously wrong.
These are from the English demo script file, but the French one gives very similar results.
Please can you investigate this effect and confirm whether there are any errors in the v1.0 files or, if not, please give me some clues about what I am doing wrong (I am a near beginner with php!). Thank you,

Bob


  2. Re: Demo not working   Reply   Report abuse  
Picture of Pierre FAUQUE Pierre FAUQUE - 2007-10-17 21:37:51 - In reply to message 1 from Bob Squires
Hello Bob,

1)
In first, the question I want to do is : is there any other one who has the same problem or do you are alone to get this error ?

2)
The secund point, I think, is : the browser (program client) has no importance because the script is executed on the server side. So, the browser gets what the script sends. I suppose it's not a browser problem.

3)
Third point: the code you wrote isn't correct. It's not :
for($n=1; $n<101; $n++) { $CBage .= "$n"; } $CBage .= "";
The code to get $CBage (Combo Box to select the age: 1..100) can be :

...
$CBage = "<select name='age'><option value='30'>"; // default selectedIndex (the first option) is 30 years old
for($n=1; $n<101; $n++) {
$CBage .= "<option value='$n'>$n";
}
$CBage .= "</select>";
...
...
echo $CBage;
...

4)
It is indicated in the Biometrics Class Page on PHP Classes that this class is written for PHP 4.x ; what is the version of PHP you are using ?

PHP 4.x
-------
In the input page, if a control is called 'age' (ex: <select name='age'>), the selected value is stored, in the output page, in the variable $age.

PHP 5.x
-------
In the input page, if a control is called 'age', the selected value is stored, in the output page, in the variable $_POST["age"] or $_GET["age"] according to the method used ('post' or 'get') in the tag FORM.

Maybe it will be necessary to do some corrections inside the scripts if you're not using PHP 4.x.

5)
The scripts published on PHP Classes are absolutly the same files than the scripts in demo use at :
fr-webdev.net/index.php?p=cbiometri ... (demo: french or english).
Can you do a test at this address ?


If this trial is good, maybe your files can be corrupted. Download the package once again from my website et do a new trial.

If your problem isn't solved with these indications, let me know more information to try to solve your problem... If you want, you can write me at my email address.

In final, I'm not an expert in PHP and may be someone have an idea about your problem. :o)

I'm waiting for your tests. See you later...

  3. Re: Demo not working   Reply   Report abuse  
Picture of Pierre FAUQUE Pierre FAUQUE - 2007-10-18 02:10:37 - In reply to message 1 from Bob Squires
Secund message because I worry a little bit about your problem... :o)
Are-you using EasyPHP ? Because the PHP interpreter in this soft has sometimes a curious behaviour. Moreover, PHP 5 (is it your PHP version ?) is a little bit different of PHP 4

You are redirected to http://www.mysitename/trials/biom/%3C?%20echo%20$PHP_SELF;%20?%3E

In fact, %3C?%20echo%20$PHP_SELF;%20?%3E means <? echo $PHP_SELF; ?>

In my opinion, this means that <? echo $PHP_SELF; ?> isn't recognized as a PHP instruction but as a filename (the page to where you are redirected.)

Instead of <? echo $PHP_SELF; ?>
try <?php echo $PHP_SELF; ?>
or <?php echo $_SERVER["PHP_SELF"]; ?>

Pierre.