taz321 Posted January 1, 2008 Share Posted January 1, 2008 Hi I am wanting a user to fill a few text fields and then click on submit for it to be saved to the database (MySQL) The table which holds this data is called Person and the attributes are - PersonID Name Age Address OrderID FormID. Now i know the personID automatically increments, but what about the foreign keys (Order & FormID), i need to put some sort of data in there otherwise it wont let me submit the form. I cant have it the foreign Keys displayed on the forms because it won't make sense to the user. Any Ideas? Thanks Link to comment https://forums.phpfreaks.com/topic/84008-writing-to-foreign-keys/ Share on other sites More sharing options...
trq Posted January 1, 2008 Share Posted January 1, 2008 I cant have it the foreign Keys displayed on the forms because it won't make sense to the user. Sounds like your looking for hidden form fields. Link to comment https://forums.phpfreaks.com/topic/84008-writing-to-foreign-keys/#findComment-427493 Share on other sites More sharing options...
taz321 Posted January 1, 2008 Author Share Posted January 1, 2008 Im using Dreamweaver and i have inputted something called Hidden Field onto my screen, but how do i use it so that data would go into the foriegn keys without obviously the user seeing them ? Thanks Link to comment https://forums.phpfreaks.com/topic/84008-writing-to-foreign-keys/#findComment-427499 Share on other sites More sharing options...
trq Posted January 1, 2008 Share Posted January 1, 2008 An example. <form method="post"> <input type="hidden" name="test" value="foo"> <input type="submit" name="submit"> </form> <?php if (isset($_POST['submit'])) { echo "The hidden field 'test' was passed with a value of " . $_POST['test']; } ?> Link to comment https://forums.phpfreaks.com/topic/84008-writing-to-foreign-keys/#findComment-427503 Share on other sites More sharing options...
taz321 Posted January 1, 2008 Author Share Posted January 1, 2008 Thanks, great I will experiment with this. Link to comment https://forums.phpfreaks.com/topic/84008-writing-to-foreign-keys/#findComment-427533 Share on other sites More sharing options...
revraz Posted January 1, 2008 Share Posted January 1, 2008 Just be aware that even though it is a hidden input field, the user can still see it if they view the source. You may want to use a session if you truely want to hide information. Link to comment https://forums.phpfreaks.com/topic/84008-writing-to-foreign-keys/#findComment-427538 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.