Jump to content

Hidden Fields and data into Foriegn Key


taz321

Recommended Posts

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>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 ?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.