...

View Full Version : [SOLVED] php_self , if and html form



zc1
01-18-2008, 12:37 PM
Hi,

I am trying to get this form to work however I am getting now where.

Part of HTML Form code



<form action="<? echo $PHP_SELF; ?>" method="post">
<input type="text" size="60" name="Title" value="<? echo $Title; ?>">
<input type="hidden" name="Returned" value="1">
<input type="hidden" name="CalendarDetailsID" value="">
<input type="hidden" name="LocationID" value="<? echo $LocationID; ?>">
<input type="submit" value="Add Event >>"></form>

Then I have some PHP code which is

if ($Returned == 1 AND !$Title) {
......

Also

} elseif ($Returned == 1) {

Every time I don't fill in the title it loops back to a blank form, instead of getting an error
If I do fill in the title it still loops back to the form and does not submit to database

What I am trying to do is use the hidden Returned code with the value 1, to submit the form to the database or give an error, but it is just looping

Has anyone got any ideas ?

I am running PHP 5.2.5 I think or that what phpinfo tells me, but cPanel tells me 5.2.3..

Regards,
Garry

abduraooft
01-18-2008, 12:45 PM
You may have to use $_POST['Returned'] , $_POST['Title'], $_SERVER['PHP_SELF'] etc

(http://in.php.net/register_globals)

StupidRalph
01-18-2008, 02:00 PM
You're also vulnerable to XSS attacks.
Links (http://www.google.com/search?hl=en&q=PHP_SELF+XSS)

zc1
01-18-2008, 02:54 PM
Hi,

Thank you for your replies :)

I have got it working by using $xxxxx = $_POST['xxxxx'];

I am going to change

<form action="<? echo $PHP_SELF; ?>" method="post">
to:

<form method="post">
As I have readed it does the same thing, will need to test that

Regards,
Garry



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum