user1687804
user1687804

Reputation: 251

Is it possible to work GET and post option together in form?

I have a form in my site. I wanna add GET and post option together. Which will indicate 2 different destination. Example : - when someone submit a form ( name and address ) then he can enter a restricted section. Then code will be

<form name="loginform"
action="http://site.com/viparea"
method="post">

And beside this i wanna keep a log.And for the log code is

<form name="loginform"
action="logcode.php"
method="GET">

And encrypted log will be save in a text file.

I have used two methods individually . And those are working fine individually. But i wanna make them work together. So, i am not a coder but after searching something i just did a simple work like a noob :P .

<form name="loginform"
action="http://site.com/viparea"
method="post"><form name="loginform"
action="logcode.php"
method="GET">

But not working. Any suggestion please.

Upvotes: 5

Views: 339

Answers (2)

Mihai Iorga
Mihai Iorga

Reputation: 39704

You can only achieve this by using:

<form name="loginform" action="http://site.com/viparea?var1=var&var2=var" method="post">
    <input type="text" name="var3" />
</form>

this way you will get var1 and var2 as $_GET, var3 as $_POST OR all 3 vars as $_REQUEST

Upvotes: 6

pomaxa
pomaxa

Reputation: 1746

No, you can't; but in php you can use $_REQUEST[], to see data from both GET and POST; you may need just a little changes in your php code.

Upvotes: 0

Related Questions