You are here: Re: Php newbie ; $connection and <?=$_SERVER['PHP_SELF']?> « PHP Language « IT news, forums, messages
Re: Php newbie ; $connection and <?=$_SERVER['PHP_SELF']?>

Posted by Hendri Kurniawan on 01/05/07 23:14

In addition to Richard answer. If you just want Apache/MySQL/PHP to
work, not knowing how they
fit together, I suggest LAMP (I think the site is called apachefriend or
something like that - Just google it,
and you'll find it). It is a package installation. You won't learn how
to set up server properly tho.

Hendri Kurniawan

psnospam@googlemail.com wrote:
> First, Happy New Year 2007 in your office with MS Office!
>
> My question is not MS related. It's about Php. I have started learning
> it although I am not a programer.
>
> I have installed Apache and MySql on my computer and set up Php to work
> along. Then I also have PhpMyAdmin working from my Usb kye to avoid any
> conflict with the Apache installation on my hard drive.
>
> As done with my curriculum, I would like to know why the following
> script doesnt work when I run it directly from the Apache Server (I get
> :
>
> "Forbidden
>
> You don't have permission to access /< on this server." :
>
> ===O===
>
> <html>
> <head>
> </head>
>
> <body>
>
> <?php
>
> $_POST = '';
>
> if (!$_POST['submit'])
>
> {
>
> ?>
>
> <form action="<?=$_SERVER['PHP_SELF']?>" method="post">
>
> Enter a number : <input name='numb' size="2">
>
> <input type="submit" name="submit" value="Valider">
>
> </form>
>
> <?php
>
> }
>
> else
>
> {
>
> $nombre = $_POST['numb'];
>
> if ($numb < 0)
>
> {echo 'your number is -';
>
> }
>
> elseif ($numb = 0)
>
> {echo 'you have entered 0';
>
> }
>
> else
>
> {echo 'your number is +';
>
> }
> }
>
> ?>
>
> </body>
>
> </html>
>
> ===O===
>
> When I run the same script on PhpMyAdmin, I have this message :
>
> Notice: Uninitialized string offset: 0 in
> g:\easyphp1-8\www\site2practise\ex15h.php on line 13
>
> line 13 is about this:
>
> if (!$_POST['submit']).
>
> and if I delete the entire "if" structure, still running the script on
> PhpMyAdmin, I get:
>
> "Notice: Undefined index: nombre in
> g:\easyphp1-8\www\site2practise\ex15.php on line 25"
>
> Line 25 is about this:
>
> $nombre = $_POST['nombre'];
>
> I don't think the last 2 errors are linked with the first one. The last
> 2 could be about the syntax and/or Php version I am running.
>
> Now I think I know the answer on how to solve the first error about
> Forbidden access
>
> It's because I have set a password when I installed Apache. And the
> issue is not the same when I run the script from PhpMyAdmin, because
> there I have no password setup. So the issue is about the syntax.
>
> How can the script above run on a Php engine that was setup with a
> password with little change? for instance
>
> -> $connection = mysql_connect($host, $user, $pass) or die ('impossible
> de se connecter!');
>
> ???
>
> Thanks,
>
> Pascal
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация