Jump to content

see the "name" of an input field


aebstract

Recommended Posts

Don't know how to topic this, but I have an input like this:

<input type=\"text\" name=\"$id$material\" value=\"{$array3['qty']}\" size=\"3\" maxlength=\"3\" />

 

Maybe I should say, several inputs. They each have a unique name as you can see. No two will be the same with this method. Now while I'm running another script after this has been submitted, I'm needing to do something if the name of this input field matches the id/material that I am currently at in my loop. So I need to compare the name before I grab the value. I have no problem grabbing the value of my inputs with a $_POST[$id$material] type of thing.

Link to comment
Share on other sites

Would it be:

$postqty = $id2.$material2;

echo "$$_POST[$postqty]";

or

$postqty = $id2.$material2;

echo "$_POST[$$postqty]";

 

The first one doesn't echo anything and the second one produces a white page.

 

 

 

edit: the actual post should be  $_POST['4mild'] or $_POST['8stainless'] something like that, which I'm needing to do a certain task whenever I get to the spot in my loop where idmaterial is = the piece inside that post bracket. Hope this makes sense.

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.