# <?php require_once "../dbcon.php"; # echo $_GET["picnr"]; ?> # <?php if (isset($_POST['define_url'])) { # $result = mysql_query("INSERT INTO booklinks (username, picnr, url) # VALUES ('".$_COOKIE['username']."', '".$_GET["picnr"]."', '".$_POST['href']."')"); # header("Location: ../engine_bookmarks/edit_books_index.php"); # } ?> # # <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> # <input type="text" name="href" maxlength="1000"> # <input type="submit" name="define_url" value="Määra"> # </form> Code (markup): The weird thing about this code is that echoing variable $_GET["picnr"] results in 1. Which is what i want. But after inserting it into the DB i see 0 as the inserted value. I did the echoing part just to know if the value is there. Helpz
Using $_REQUEST is not a good idea, it's insecure and so it using the super global $_SERVER['PHP_SELF'] to submit the form to itself. For development purpose it's find but not for final output script. Why you should not use $_SERVER['PHP_SELF'] there are other problems with your code also but reading is a good start.
On first glance, I my first suspicion would be a problem with all the quote marks. Could be causing a parsing problem. Might try this: $picnr = $_GET["picnr"]; then use $picnr in your sql statement. Notice that your GET uses double quotes, but your COOKIE and POST variables use single quotes.