Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

html

php

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.

like image 647
user1687804 Avatar asked Sep 21 '12 05:09

user1687804


1 Answers

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

like image 85
Mihai Iorga Avatar answered Oct 23 '22 17:10

Mihai Iorga