0

is there any way to get a form name from a page that the post or get variables sent from ?

for example : $_POST , $_POST .. What would it be if you wanted the form name to be sent ?

3
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by sDJh
0

HTTP doesn't transfer any information about the form, because the website generates the code itself. I believe that the tag "name" was added with JavaScript to access these field in JS.

But what do you need it for? The only thing I can imagine is one of these phishers or cookie-grappers. If you want to know how this works you better don't ask me.

0

nah i just want to make sure that these variables came from the form i have set up and not from someone who is trying to hack their way in ... just another security measurement in a login form

0

I am not sure if its possible in Php. But its definitely possible in javascript.

<html>
<head>
<script type="text/javascript">
function getformname(form) {
	alert(form.name);
	return false;
}
</script>
</head>
<body>
<form name="test" action="test.php" method="post" onsubmit="javascript: return getformname(this);">
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>

Cheers,
Nav

0

then why don't you vary the names of the textfields? Eg

name="name<?echo date("Y-m-d")?>"
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.