Php header('Location") error

Posted by Umeed on Stack Overflow See other posts from Stack Overflow or by Umeed
Published on 2012-06-22T02:55:54Z Indexed on 2012/06/22 3:16 UTC
Read the original article Hit count: 116

Filed under:

I'm having some difficulty with my php coding.

I have 3 files, add.php, lib.php, and view.php

I created a simple form, and when the user clicks submit, it should direct them to the view.php where it will display the database. Now I'm having a couple issues I can't seem to resolve.

when the user clicks submit and the fields are blank or there is an error no entry should be made into the view page (or database)...however when I click submit a blank entry is made into the database. ALSO if i click "enter product" from the top menu bar anytime I click it, it causes a blank entry into the database. I can't figure out why that's happening.

My next issue is with the header('Location') and my browser says:

"Warning: Cannot modify header information - headers already sent by (output started at lib.php:13) in add.php on line 16"

However if I click submit on my form it goes away.

Here is the code for the pages:

http://ideone.com/Vvz8x

I truly apologize if the code is really messy.

Any help / advice / solution is greatly appreciated thank you.

And yes this was an assignment---it was due last week but since I couldn't finish it, it's not worth any marks anymore.

© Stack Overflow or respective owner

Related posts about php