简体   繁体   中英

HTML form: how to submit a value without showing it in the form?

I have an HTML form that sends a food dish. For example,

placeorder.com/order.php?id=STEAK

I want to add another value and send

placeorder.com/order.php?category=MEAT&id=STEAK

But, I don't want the user to have to select meat anywhere, since this has been already decided.

I tried to tinker with the form target and include it from there, but it didn't work.

Is there some "hidden text box" to write the category to so that it gets posted, or is there another way to do it?

Thanks in advance!

First, I just thought I'd mention that it's funny how the questions is phrased since you pretty much answered your own question:

Is there some "hidden text box"

Anyway, yes:

You can use type='hidden'

I assume that you are already using a GET form so I will just include the input part:

<input name='category' type='hidden' value='MEAT'>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM