Thursday 15 March 2012

PHP form not updating sqlite database -


I have a PHP form, which is to add a book to a table of books in a SQLite database. The form presents, though a book does not link to my database.

  & lt ;? Php session_start (); Required ("books.php"); Required ("layout.php"); $ Db = sqlite_open ("products.db", 0666, $ error); $ Header; Echo "& lt; p & gt; & lt; a href = '. / Index.php' & gt; Bookshop & lt; / a & gt; & lt; / p & gt;"; Then enter "

Add Books


value: & lt; input type = ' EX name = 'value' & gt; & lt; br & gt; Category 1: & lt; input type = 'text' name = 'cat 1' & gt; & lt; br & gt; Category 2: & lt; ; Input type = 'text' name = 'cat2' & gt; & lt; br & gt; input type = 'submit' value = 'submit' name = 'submit' & gt; ; / Form & gt; & lt; / p & gt; "; If (isset ($ _ POST ['Submit'])) $ $ Author = $ _POST ['Author']; $ Heading = $ _POST ['title']; $ Abstract = $ _POST ['summary']; $ Isbin = $ _POST ['ISBN']; $ Publisher = $ _POST ['publisher']; $ Imgnm = $ _POST ['IMGNIM']; $ Value = $ _POST ['value']; $ Cat1 = $ _POST ['cat 1']; $ Cat2 = $ _POST ['cat2']; Prices ('$ _POST [author]', '$ _POST [title]', '$ _POST [value] ($ $ _P), ($ $ _POST,' $ _POST [ISBN] ',' $ _POST [publisher] ' $ $ _POST [Cat 1] ',' $ _POST [Cat 2] '); echo ("book added!"); $ Dbh,' $ _POST [IMGNIM] ',' $ _POST [value] ',' $ _POST = Null;}?

Why is this code not updating my database properly? Before I add that statement, when loading on page An empty book is added to the bar database, but now it submits and resets form, my URL Looks correct, but the database did not find any items in it.

Your code silently , because you are using the GET method in your form, while you are using the post array

  • Change the form of the post to change.

I also need to indicate that your current code is open, or they are more secure .


No comments:

Post a Comment