Problem in simple data entry form

Discussion in 'PHP' started by globalcashsite, Dec 14, 2009.

  1. #1
    Guys

    From hours I am working on a small simple php data entry form but due to some reasons I am fail, please check this code

    When I click submit after data entry a blank page opens and url turns like

    "http://www.globalcashsite.com/manager/signup1.php?submit=&desc=ksjdkasdjlksdj&email=lsjdalkjdlksdjs%40gamic.om&type=Site&status=Active&remarks=asdasdsa&submit=Submit"

    I don't know where I am making mistake.

    GCS
     
    globalcashsite, Dec 14, 2009 IP
  2. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #2
    <FORM name='signup" action="signup1.php" method="post">

    Try that
     
    Bohra, Dec 14, 2009 IP
  3. globalcashsite

    globalcashsite Peon

    Messages:
    806
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Ohh I think that is really mistake, name and action should be signup1.php?????

    GCS
     
    globalcashsite, Dec 14, 2009 IP
  4. Bohra

    Bohra Prominent Member

    Messages:
    12,573
    Likes Received:
    537
    Best Answers:
    0
    Trophy Points:
    310
    #4
    no what exactly do u want to do ??
     
    Bohra, Dec 14, 2009 IP
  5. creativeGenius

    creativeGenius Well-Known Member

    Messages:
    273
    Likes Received:
    5
    Best Answers:
    1
    Trophy Points:
    120
    #5
    assuming you have register globals turned off, you should assign the posted vars to your own var first...
    eg: $desc = $_POST['desc'];

    then, looking at your sql, you can easily tell that it will cause an error because the fields does not match up with the data, make sure the field and data match up accordingly
     
    creativeGenius, Dec 14, 2009 IP
  6. globalcashsite

    globalcashsite Peon

    Messages:
    806
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks buddy, actually I tried this without adding record in database.

    Instead of adding record in database I tried to print some comments or tried Alert box but script was not coming into if($submit) loop?

    GCS
     
    globalcashsite, Dec 14, 2009 IP
  7. creativeGenius

    creativeGenius Well-Known Member

    Messages:
    273
    Likes Received:
    5
    Best Answers:
    1
    Trophy Points:
    120
    #7
    so that confirms that you have register globals off..

    try to view the posted vars and values using this code...

    if( !empty($_POST['submit') )
    {
    echo '<pre>';
    print_r($_POST);
    }
     
    creativeGenius, Dec 14, 2009 IP
  8. globalcashsite

    globalcashsite Peon

    Messages:
    806
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Actually $submit is "Submit" button of form?

    GCS
     
    globalcashsite, Dec 14, 2009 IP
  9. creativeGenius

    creativeGenius Well-Known Member

    Messages:
    273
    Likes Received:
    5
    Best Answers:
    1
    Trophy Points:
    120
    #9
    not yet, at this point $submit is an empty variable, since you havent assigned anything to it

    unless you do this...

    $submit = $_POST['submit'];

    when your server have Register Globals Off (and by default this is usually off for security reasons) your posted variables does not in any way magically become variables, you need to assign them explicitly
     
    creativeGenius, Dec 14, 2009 IP
  10. globalcashsite

    globalcashsite Peon

    Messages:
    806
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Thank you buddy, I was understanding logic why my code was not working and you helped me to understand this. Although I paid money to someone for custom data entry form and get this problem solved but it is also important to understand logic. :)

    GCS
     
    globalcashsite, Dec 14, 2009 IP
  11. creativeGenius

    creativeGenius Well-Known Member

    Messages:
    273
    Likes Received:
    5
    Best Answers:
    1
    Trophy Points:
    120
    #11
    no worries mate, glad i could be of any help :)
     
    creativeGenius, Dec 14, 2009 IP
  12. masterofweb

    masterofweb Greenhorn

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #12
    change
    <FORM name=signup action=signup1.php method=post">

    this line to

    <FORM name="signup" action="" method="post">
     
    masterofweb, Dec 17, 2009 IP