Monk25
Monk25

Reputation: 25

How to display a text without the last 15 characters but on resubmit to submit the whole text?

I've got log page on my user's panel, where people can see their latest Hardware ID number (grabbing it from the table which is running on MSSQL Server 2005) with which they've logged into. I'm displaying it like that (below) to make sure that the latest 20 characters are displayed with x only and it's displayed in a drop-down menu where they can select it.

'hwid' => substr_replace($row['HWID'], 'x', -20),

However, they can use this HWID to submit a form on the drop down menu and if they do that, it will be submitted as it's displayed. So, how I can display it like that without the latest characters but somehow, hiddenly, to submit back from the drop-down menu the full HWID number?

Example: Drop down shows only like that to pick: da45cba96982x but if they RE-submit to submit to the server the full one: da45cba969829nah2bkanzh2hz It's just example.

Please let me know if you have an idea?

Upvotes: 0

Views: 52

Answers (2)

Twicetimes
Twicetimes

Reputation: 678

@PHP Weblineindia's answer is probably what you're looking for, but if the HWID is a sensitive field, you might want to map it to some other id which you then use to populate the form, eg:

<select>
    <option value="simple_id">Short Code</option>
</select>

and then on the server, map simple_id back to the 'real' HWID. This way, only the xxx-ified version is ever delivered to the browser.

Upvotes: 1

user4094161
user4094161

Reputation:

your option element should be in below format:

<select>
<option value = "full_code">Short Code</option>
</select>

This way it will show short code with limited character in dropdown but when form is posted you will get full value.

Hope this is what you are looking for?

Upvotes: 1

Related Questions