taz321 Posted January 2, 2008 Share Posted January 2, 2008 Hi I have another query here. This is my form is to be inserted into the DB, the last two fields are OrderID and AreaID, but i cant let the user insert into here because it wouldnt make sense to them, so i have a a general idea of what hidden fields do, can someone show me with some example code on how i could add data into the hidden fields without the user having to do so because i am abit confused by them. Thanks <form name="person.php" method="get"> <table width="1135" border="0"> <tr> <td width="99">Name</td> <td width="182"> <label> <input name="NAME" type="text" id="NAME"> </label> </td> <td width="840"> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>Age</td> <td> <label> <input name="AGE" type="text" id="AGE"> </label> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>Address</td> <td> <label> <input name="ADDRESS" type="text" id="ADDRESS"> </label> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>Order ID </td> <td> <label> <input name="ORDERID" type="text" id="ORDERID"> </label> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td>AreaID</td> <td> <label> <input name="AREAID" type="text" id="AREAID"> </label> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> <label> <input type="submit" name="Submit" value="Submit"> </label> </td> </table> Quote Link to comment https://forums.phpfreaks.com/topic/84187-hidden-fields-and-data-into-foriegn-key/ Share on other sites More sharing options...
trq Posted January 2, 2008 Share Posted January 2, 2008 an someone show me with some example code on how i could add data into the hidden fields Your question is pretty vague. Where exactly do you expect this data to be comming from? Quote Link to comment https://forums.phpfreaks.com/topic/84187-hidden-fields-and-data-into-foriegn-key/#findComment-428598 Share on other sites More sharing options...
taz321 Posted January 2, 2008 Author Share Posted January 2, 2008 Sorry, what im saying is would i need to make the data static meaning hardcoding it into the actual code as i wouldnt expect the user to insert it in. I have Name Age Address OrderID AreaID the user would input data for the first 3, but not the last 2 as it wouldnt make sense to them. I hope this clarifies this. Quote Link to comment https://forums.phpfreaks.com/topic/84187-hidden-fields-and-data-into-foriegn-key/#findComment-428602 Share on other sites More sharing options...
trq Posted January 2, 2008 Share Posted January 2, 2008 I hope this clarifies this. Not at all. What exactly is the intended purpose of this form? If you think you can hardcode the data into hidden fileds on the form, then you may as well simply hard code the values into your query and forget the hidden fields all togther. Make sense? This probably isn't want you want however. You'll need to explain what the intended purpose of this form is and what part it plays in the whole process. Quote Link to comment https://forums.phpfreaks.com/topic/84187-hidden-fields-and-data-into-foriegn-key/#findComment-428616 Share on other sites More sharing options...
taz321 Posted January 2, 2008 Author Share Posted January 2, 2008 This form was just an example so that i can see how a hidden field works. i am creating a helpdesk system and a client fills in a form with the details formID issuetitle datesubmitted systemaffected prioritylevel issuedetails supportcomments teamname clientID employeeID FormID automatically increments as its the primary key The ClientID and employeeID are foriegn Keys The user will type his personal and query details in the above fields. The details would be displayed in another screen where the actual technician would see the query and add his own comments on and then submit the form to an archive page. Is This clear now ? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/84187-hidden-fields-and-data-into-foriegn-key/#findComment-428638 Share on other sites More sharing options...
trq Posted January 2, 2008 Share Posted January 2, 2008 OK, I understand what your trying to do now and to be honest, there is probably no need for the data to be within a hidden field at all. Are your clients logged in to the helpdesk application when they make these requests? How? Sessions? If so you would simply populate the ClientID foriegn key value using the ClientID that I assume is stored within the $_SESSION array when they are logged in. If your users are not logged in I'm not sure how you expect the system to recognise them in order to create this relationship. Quote Link to comment https://forums.phpfreaks.com/topic/84187-hidden-fields-and-data-into-foriegn-key/#findComment-428715 Share on other sites More sharing options...
taz321 Posted January 3, 2008 Author Share Posted January 3, 2008 Hi The clients do not need to login into the system, the people who log into the system are the IT Technicians, managers ect.. The clients simply fill in the form and submit it, the IT Technicians would need to log into the system to see the form and solve it. So is there no way to add a value in the foreign keys so that it adds to my database, can you suggest any other way ? Quote Link to comment https://forums.phpfreaks.com/topic/84187-hidden-fields-and-data-into-foriegn-key/#findComment-429571 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.