Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

post url with 2 input

by bigup401 (Pilgrim)
on Jun 23, 2017 at 09:34 UTC ( [id://1193338]=perlquestion: print w/replies, xml ) Need Help??

bigup401 has asked for the wisdom of the Perl Monks concerning the following question:

how can i make url post with input choices

<input $1> <input $2>

how can i make it in url to either take input1 or input2

post => http://link/take input $1 or input $2

Replies are listed 'Best First'.
Re: post url with 2 input
by marto (Cardinal) on Jun 23, 2017 at 09:41 UTC

      lets say

      $input1 = $cgi->param() $input2 = $cgi->param()

      and i want to make url post

      post => $input or $input2

        I'd probably start by suggesting that you write using Mojolicious::Lite rather than CGI in future, since it makes all this stuff easier with the Mojo modules. Regardless my previous answer suggests looking at the docs for LWP::UserAgent, the post() method which provides a working examples for exactly what you want to do. If you want to use a tool, read and understand the manual.

Re: post url with 2 input
by hippo (Archbishop) on Jun 23, 2017 at 09:41 UTC
Re: post url with 2 input
by scorpio17 (Canon) on Jun 23, 2017 at 13:23 UTC
    You can't "or" inputs within the url. You'll have to submit BOTH, and then the backend script that handles the request can implement whatever logic you require (i.e., check each input field for valid values, etc).
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1193338]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-06-21 16:28 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.