This topic is locked

copy user input from html as variable

5/31/2020 12:08:31 PM
PHPRunner General questions
K
Kervee author

Hello guys,
I created a very simple html code into a page (see below) where the user will input a text (I did it in the Editor section of PHPrunner), I need to get that text the user inputs from that form as a variable in the events section so I can use it for another code, is this possible? can you give me an example?
<form action="/getpayoutstatus_list.php" method="post">

<label>

Created After

</label>

<input type="text" name="createdafter" value="1900-01-01">

<input type="submit" name="submit" value="submit">

</form>
Many thanks!

Admin 5/31/2020

Are we talking about PHPRunner application or about something else?

K
Kervee author 5/31/2020

Hi,
Yes, in PHPRunner, is it possible?
Many thanks

Admin 6/1/2020

It is not recommended and not required to create your own HTML forms in PHPRunner.
What exactly you trying to achieve?

K
Kervee author 6/1/2020



It is not recommended and not required to create your own HTML forms in PHPRunner.
What exactly you trying to achieve?


Hi, I came up with this idea because some of the parameters in my request API URL needs to be a user input, example is when I am requesting only a portion from a big bunch of data and so I put in the parameter request to just retrieve data from dates newer than 2020-01-01 for example, below is the sample api url i was talking about, and you will see that one of the parameters is called 'created_after' and you will notice that the value is set to 2020-01-01, so it will only give json response of data created from that date, I want user to be able to put their own date and use that as a request parameter in the url
'https://mywebsiteurl.com/rest/finance/payout/status/get?created_after=2020-01-01&app_key=112835&sign_method=sha256&timestamp=1591030163347&access_token=50000401228pwpZzh1Djp9VSjacFxhpSUFklNH4I1c512bbdUWCd2kTTBG8bP5A&sign=4139C5C43875EDF9ECA9420ED100DC3378F8F38D5DC57170F42728F5A12E4E6D'
If there is another way than creating an html form, please please share some example, many thanks!

Admin 6/2/2020

The point here is not just to perform the post but to get the results back and do something with these results. I would rather add a custom button to this page that can read data from regular edit controls and then perform the post in the Server part of the button using curl functions. You can see an example of such a code in this article:

https://xlinesoft.com/blog/2020/05/24/dynamic-login-page-background/
This way you can capture the response, parse it and do something useful with it.

fhumanes 6/2/2020

Hello:
In this example https://asprunner.com/forums/topic/27340-phprunner-app-client-restful-api/ I explain how you can retrieve data from a RESTfull service and save it to a table or manipulate it as required.
In the example, you have to see the examples of capturing the data from the RESTfull service and doing the insert in tables.
Greetings,