How to remove &submit=submit

hi all

i am trying to submit the form and redirect the form to “action” path url

but after submitting the form i get the redirected to the url

http://localhost/form.php?fdate=1-2-2016&sdate=1-3-2016&submit=submit

how can i remove the &sumit=submit from the url.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<?php
if(isset($_REQUEST['submit']))
{
$fdate = $_REQUEST['fdate'];
$sdate = $_REQUEST['sdate'];
$action = $_SERVER['PHP_SELF']."?fdate=".$fdate."&sdate=".$sdate;
}
?>
<form action="<?php if(isset($action)){echo $action;} ?>" method="get">
<input type="text" name="fdate" />
<input type="text" name="sdate" />
<input type="submit" name="submit" value="submit" />
</form>
</body>
</html>

i tried it with input type=button

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

but input type button doesnt submit the form and does nothing.

how to remove &submit=submit

vineet

don’t give the button a name.

It is more usual to use method=“post”

then what will i write in this isset code if i dont give it a name.

if(isset($_REQUEST['submit']))

vineet

i know
but i want to see the dates in the url

vineet

It is not.
HTTP protocol RFC clearly states that requesting data should be done with GET

Hi Dormilich

yes you were right.

I changed name with id

now its working fine

thanks

vineet

you check for the expected data, not for the submit button.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.