Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    zc1
    zc1 is offline
    New Coder
    Join Date
    Jun 2007
    Posts
    29
    Thanks
    8
    Thanked 0 Times in 0 Posts

    [SOLVED] php_self , if and html form

    Hi,

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

    Part of HTML Form code
    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
    Code:
    if ($Returned == 1 AND !$Title) {
    ......
    Also
    Code:
    } 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
    Last edited by zc1; 01-18-2008 at 08:33 PM.

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,862
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    You may have to use $_POST['Returned'] , $_POST['Title'], $_SERVER['PHP_SELF'] etc

    (http://in.php.net/register_globals)
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    zc1 (01-18-2008)

  • #3
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    You're also vulnerable to XSS attacks.
    Links
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.

  • Users who have thanked StupidRalph for this post:

    zc1 (01-18-2008)

  • #4
    zc1
    zc1 is offline
    New Coder
    Join Date
    Jun 2007
    Posts
    29
    Thanks
    8
    Thanked 0 Times in 0 Posts
    Hi,

    Thank you for your replies

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

    I am going to change
    Code:
    <form action="<? echo $PHP_SELF; ?>" method="post">
    to:
    Code:
    <form method="post">
    As I have readed it does the same thing, will need to test that

    Regards,
    Garry


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •