Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple values for submit button

Status
Not open for further replies.

chrismassey

Programmer
Aug 24, 2007
264
GB
Hello,

I am using a set of submit buttons to submit data to a Perl script. However one issue I have is that its value is not only the value where I can store data, but also the value that is printed on the submit button. However the value I send to the script must be different from the value I print on the submit button itself. I have tried using links to carry data but have been unsuccessful... Any ideas?

Thanks,

Chris
 
You could use the name attribute on the button to convey meaning - you can test it server-side to see if it was sent as part of the form submission (since only the submit button that was clicked will be sent with the submission).

Another alternative is to use the button element:
Code:
<button type="submit" name="sendbutton3" value="Some data">Send Order Now!</button>

Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Jeff,

Thanks for responding. I haven't tried the button element yet, but that seems to be the perfect solution. Thank you very much.

Chris
 
Hey,

Really odd, it hasn't worked... Here is my button...
Code:
<button type="submit" name="button" value="$_" style="background-color: #FFFFFF; font-family: Arial; font-size: 10pt; text-decoration: underline; color: #0000FF; border-style: solid; border-color: #FFFFFF">$button_print</button>
The $_ is simply the current value (from a loop system in my Perl script) and the $button_print is the name I have chosen to be printed on the button.

Here is the HTML source of one of the buttons once the loop has finished...
Code:
<button type="submit" name="button" value="03=Page2.htm" style="background-color: #FFFFFF; font-family: Arial; font-size: 10pt; text-decoration: underline; color: #0000FF; border-style: solid; border-color: #FFFFFF">Page2.htm</button>

And this is the value the script takes
Code:
Page2.htm

The value should obviously be "03=Page2.htm"

Thanks for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top