Jump to content

Recommended Posts

Hello, new here!

 

I have a question on a script im about to create...

 

I'm wondering weather some thing like this could be done... I am creating a form and it is going to show all the rows but only some of the fields relating to each row.

 

Now say it showed like 3 rows.... and 2 of them are identical... though the user can only pick one... how can I get that row that the user picked to find the rowID? I can't use WHERE against the 2 variables that the user has picked, because it'll find more than one row...

 

So i need a clever way for each row being displayed though not showing the ID to the user, yet the ID needs to be along side it so that the process knows which row to deal with when the user has chosen it...

 

Sorry if that sounds a bit confusing... I have not coded it yet by the way. I wanted to see if any knows a way to do this.. possibly like hiding the value of ID but still being loaded in the form :/ ?

 

Let me know any way.

Link to comment
https://forums.phpfreaks.com/topic/68106-question-about-forms/
Share on other sites

A drop down works like this:

<select name="yourNameHere">
   <option value="value1">Text1</option>
   <option value="value2">Text2</option>
   <option value="value3">Text3</option>
</select>

 

The relevant PHP code would be on your processing page:

$selected = $_POST['yourNameHere']; //will be either value1, value2 or value3

Link to comment
https://forums.phpfreaks.com/topic/68106-question-about-forms/#findComment-342370
Share on other sites

<select name="yourNameHere">

  <option value="value1">Text1</option>

  <option value="value2">Text2</option>

  <option value="value3">Text3</option>

</select>

 

 

So if i wanted to change option value to ID of row i would do..

 

<select name="yourNameHere">

  <option value="<?=$rowid?>">Text1</option>

  <option value="<?=$rowid?>">Text2</option>

  <option value="<?=$rowid?>">Text3</option>

</select>

 

 

But put some form a while loop to do a fetch assoc?

Link to comment
https://forums.phpfreaks.com/topic/68106-question-about-forms/#findComment-342374
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.