FORM ACTION with DHCP IP

I need get the values in text box, but I need use DHCP IP, this my code:

client.println("<FORM ACTION=\"http://192.168.1.1:80\" method=get >");

I not want put my ip, I want DHCP IP, how I do this?

I use Ethernet Shield W500.

Thanks!

How would you get your DHCP allocated IP as a c-String?
If you know how to do this, then just do multiple client.print() to build the right output

use relative url. if the request of the form goes to the sever of the html page you do not need to specify a host and port in form action url

J-M-L:
How would you get your DHCP allocated IP as a c-String?
If you know how to do this, then just do multiple client.print() to build the right output

But I need put the IP in a variable and put this variable in the form action. But when put this variable in the form action returns error.

lucasgss:
But I need put the IP in a variable and put this variable in the form action. But when put this variable in the form action returns error.

Then perhaps you should post that code and that error message.

Juraj:
use relative url. if the request of the form goes to the sever of the html page you do not need to specify a host and port in form action url

but the url changes according to ip. Have you a example?

lucasgss:
but the url changes according to ip. Have you a example?

simply leave out the begging of the url. start with /. you should have some name after the url to identify the request.

method GET is default

But I need put the IP in a variable and put this variable in the form action. But when put this variable in the form action returns error.

You need to do this ONLY is you want EVERY response for the server, no matter which client (IP) issued the GET request, to go to the same device.

That is EXTREMELY unlikely to be what you want.

Juraj:
simply leave out the begging of the url. start with /. you should have some name after the url to identify the request.

method GET is default

Thanks so much, this resolved for me.

this is the code that solved.

client.println("<FORM ACTION=\"\" method=get >");

lucasgss:
this is the code that solved.

client.println("<FORM ACTION=\"\" method=get >");

that is

<FORM ACTION="" method=get >