Results 1 to 5 of 5

Thread: !isset $_POST submit

  1. #1
    Join Date
    Oct 2005
    Posts
    255
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default !isset $_POST submit

    hi I am trying to make something to do as insert into my database...
    i have done this before and i dunno why its not working.. plz help.

    Code:
    <?PHP
    include('dbconnect.php');
    
    if (!isset($_POST['submit'])) {
    ?>
    <form action="insertdl.php" method="post"> 
    url: <input name="url" type="text"> 
    <input type="submit" value="submit" name="submit">
    </form>
    
    <?PHP
    } else {
    
    
    $url = $_POST['url'];
    $count = 1;
    
    mysql_query("INSERT INTO downloads 
    (link, count) VALUES('$url', '$count' ) ") 
    or die(mysql_error());  
    
    echo' "data inserted";
    }
    
    ?>
    plz help
    Hey new design new look, goto xudas for personal webdsign help.. (:

  2. #2
    Join Date
    Feb 2008
    Location
    Coventry
    Posts
    103
    Thanks
    5
    Thanked 8 Times in 8 Posts

    Default

    I duno i dont see why it shouldnt be working, but you have got an extra quote where you say echo ' "data inserted"; also shouldnt you do a check to make sure that the query was a result, i duno thats what i do, especially when im inserting stuff.

    anyway try it the other way round, or try checking for $_POST['url'] or try getting it and changing post to get in the form.

    besides that which you have probably done, i dont see why
    The important thing is not to stop questioning. Curiosity has its own reason for existing.

  3. #3
    Join Date
    Oct 2005
    Posts
    255
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    i did check before doing the form submit to see if it did insert into the database and it doesn't..
    not there is something wrong with the submit its not recongizing the the forum submit post, i dunno why its not....

    with the echo, it will still work i just messed up when posting the code here...
    Last edited by insanemonkey; 04-21-2008 at 04:44 PM.
    Hey new design new look, goto xudas for personal webdsign help.. (:

  4. #4
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    try this:
    Code:
    <?PHP
    include('dbconnect.php');
    
    if (!isset($_POST['url'])) {
    ?>
    <form action="insertdl.php" method="post"> 
    url: <input name="url" type="text"> 
    <input type="submit" value="submit" name="submit">
    </form>
    
    <?PHP
    } else {
    
    
    $url = $_POST['url'];
    $count = 1;
    
    mysql_query("INSERT INTO downloads 
    (link, count) VALUES('$url', '$count' ) ") 
    or die(mysql_error());  
    
    echo "data inserted";
    }
    
    ?>
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@§†ê® §©®¡þ† /\/\@|{ê®
    There are 10 kinds of people in the world, those that understand binary and those that don't.

  5. #5
    Join Date
    Oct 2005
    Posts
    255
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    ok i got it.. i dont know what the problem was but it all of sudden started working 10minutes later... i think my cache maybe or cookies... i dunno.. but thanks guys
    Hey new design new look, goto xudas for personal webdsign help.. (:

Bookmarks

Posting Permissions

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