Form-server doubt
Posted by: warforged (---.prod-infinitum.com.mx)
Date: December 26, 2006 11:39PM

Hi everyone, I'm a newbie, and I'm studying from this book that has a post example. In the form action appears the folowing tag "<?=$_SERVER['PHP_SELF']?>" my book says, that it is to use one simple combined page rather than an html an php separate documents. The problem is that when I try to run it, the sever gives me the following message "You don't have permission to access /< on this server.
Apache/2.0.59 (Win32) PHP/5.2.0 Server at localhost Port 80", and I don't know why.

I would really appreciate your help.

Thanx = )

Options: ReplyQuote
Re: Form-server doubt
Posted by: Rivernet1 (---.du.volcano.net)
Date: December 29, 2006 02:56AM

Did you ever get this resolved?

Options: ReplyQuote
Re: Form-server doubt
Posted by: dp_pearce (195.101.42.---)
Date: January 10, 2007 01:01PM

I have the same problem, and it looks like it is from the same book. Again I am a newbie so any hints would be greatly appreciated.

Options: ReplyQuote
Re: Form-server doubt
Posted by: dp_pearce (195.101.42.---)
Date: January 10, 2007 01:05PM

In fact I guess it might just be easier to post the example and let you experts spot our stupid errors.

<html>
<head><basefont face="arial"></head>
<body>

<?php

if (!$_POST['submit'])
{
?>
<form method="post" action="<?=$_SERVER['PHP_SELF']?>">
Enter number of rows
<input name="rows" type="text" size="4">
and columns
<input name="columns" type="text" size="4">
<input type="submit" name="submit" value="Draw Table">
</form>
<?php
}
else
{
?>
<table border="1" cellspacing="5" cellpadding="0">
<?php
//set variable from input
$rows = $_POST['rows'];
$columns =$_POST['columns'];

//loop to create rows
for ($r = 1; $r <= $rows; $r++)
{
echo "<tr>";
//loop to create columns
for ($c = 1; $c <= $columns; $c++)
{
echo "<td>&nbsp;</td>\n";
}
echo"</tr>\n";
}
?>
</table>
<?php
}
?>

</body>
<html>

Again thanks for your time

Options: ReplyQuote
Re: Form-server doubt
Posted by: dp_pearce (195.101.42.---)
Date: January 11, 2007 12:06PM

OK I seem to have managed to resolve this problem, although please feel free to comment if my method is bad practice.

<form method="post" action="<?=$_SERVER['PHP_SELF']?>">

changes to

<form method="post" action="<?php echo $_SERVER['PHP_SELF']?>">

So basically all instances of '<?=...' change to '<php echo ..." and this seems to have the desired effect.

Dan

Options: ReplyQuote
Re: Form-server doubt
Posted by: yfastud (72.236.169.---)
Date: January 11, 2007 01:39PM

Quote


So basically all instances of '<?=...' change to '<php echo ..." and this seems to have the desired effect.
Actually, <? should be <?php because short_open_tag is off by default.

Have fun

[www.jlbn.com] (testing web server)
[test.jlbn.com] (testing codes)
[forum.jlbn.com] (testing phpBB2)
[forums.jlbn.com] (testing phpBB3)
[mail.jlbn.com] (testing mailserver)
[ftp.jlbn.com] (testing ftp server)
[www.jlbn.com] (testing flashes)
[www.jlbn.com] (testing images)
[joomla.jlbn.com] (testing Joomla 1.0.10)
[fusion.jlbn.com] (testing phpFusion 6.01.6)
[nuke.jlbn.com] (testing phpNuke 7.9)
[nukep.jlbn.com] (testing phpNuke Platinum 7.6.b.4v2)
[pnuke.jlbn.com] (testing PostNuke 0.800-MS2)
[nukevo.jlbn.com] (testing phpNuke Evolution 2.0.1)

Options: ReplyQuote
Re: Form-server doubt
Posted by: warforged (---.prod-infinitum.com.mx)
Date: January 11, 2007 04:43PM

So I changed the tags, and the same error keeps appearing:

403 Forbidden

You don't have permission to access /< on this server.
Apache/2.0.59 (Win32) PHP/5.2.0 Server at localhost Port 80

Here's the code:

<html>
<head></head>
<body>
<?php
if (!$_POST['submit'])
{
?>
<form action="<?php=$_SERVER['PHP_SELF']?>" method="post">
Enter a number: <input name="number" size="2">
<input type="submit" name="submit" value="Go">
</form>
<?php
}
else
{
$number = $_POST['number'];
if ($number > 0)
{
echo 'You entered a positive number';
}
elseif ($number < 0)
{
echo 'You entered a negative number';
}
else
{
echo 'You entered 0';
}
}
?>
</body>
</html>

Thank you all = )

Options: ReplyQuote
Re: Form-server doubt
Posted by: yfastud (72.236.169.---)
Date: January 11, 2007 04:49PM

Always restart server after any changes

Have fun

[www.jlbn.com] (testing web server)
[test.jlbn.com] (testing codes)
[forum.jlbn.com] (testing phpBB2)
[forums.jlbn.com] (testing phpBB3)
[mail.jlbn.com] (testing mailserver)
[ftp.jlbn.com] (testing ftp server)
[www.jlbn.com] (testing flashes)
[www.jlbn.com] (testing images)
[joomla.jlbn.com] (testing Joomla 1.0.10)
[fusion.jlbn.com] (testing phpFusion 6.01.6)
[nuke.jlbn.com] (testing phpNuke 7.9)
[nukep.jlbn.com] (testing phpNuke Platinum 7.6.b.4v2)
[pnuke.jlbn.com] (testing PostNuke 0.800-MS2)
[nukevo.jlbn.com] (testing phpNuke Evolution 2.0.1)

Options: ReplyQuote


Sorry, only registered users may post in this forum.