CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [terrykhatri531] How to implement a checkbox that will send data to db: Edit Log



Zhris
Enthusiast

Jul 11, 2014, 4:51 AM


Views: 32325
Re: [terrykhatri531] How to implement a checkbox that will send data to db

Hi Terry,

It looks like you have multiple buttons per page and have attempted to use the src attibute to handle each individually. The src attribute cannot be used in this way, it is used to specify the URL of an image to use as the button. Also, if you haven't wrapped your button in a form, then nothing will happen. Finally note that there is no = between orderid and your template param in the query string.

If I have assumed correctly, the following alternatives may suffice:

Use a link instead (best option):

Code
<td> 
<a href="orddetails.pl?go=Details&orderid=<!-- TMPL_VAR NAME=OrderID -->">Details</a>
</td>


Use multiple forms that post to the appropriate URL (update: I don't think this will actually work, I haven't tested but, I don't think you can mix GET and POST params together):

Code
<td> 
<form method="post" action="orddetails.pl?orderid=<!-- TMPL_VAR NAME=OrderID -->">
<input type="submit" name="go" value="Details" />
</form>
</td>

Similar to the above, but uses a hidden field for order id:

Code
<td> 
<form method="post" action="orddetails.pl">
<input type="hidden" name="orderid" value="<!-- TMPL_VAR NAME=OrderID -->" />
<input type="submit" name="go" value="Details" />
</form>
</td>


Use a single form but incorporate the order id into the name of the button, handling this in your script shouldn't be too tricky:

Code
<form method="post" action="orddetails.pl"> 
...
<td>
<input type="submit" name="go_<!-- TMPL_VAR NAME=OrderID -->" value="Details" />
</td>
....
</form>


Similar to the above, but incorporate into the value instead:

Code
<form method="post" action="orddetails.pl"> 
...
<td>
<input type="submit" name="go" value="Details for order <!-- TMPL_VAR NAME=OrderID -->" />
</td>
....
</form>


Regards,

Chris


(This post was edited by Zhris on Jul 11, 2014, 1:46 PM)


Edit Log:
Post edited by Zhris (Enthusiast) on Jul 11, 2014, 4:53 AM
Post edited by Zhris (Enthusiast) on Jul 11, 2014, 4:55 AM
Post edited by Zhris (Enthusiast) on Jul 11, 2014, 5:08 AM
Post edited by Zhris (Enthusiast) on Jul 11, 2014, 1:46 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives