Pluto
Pluto

Reputation: 333

submit a form without using $_POST

I have to figure out someone's codes... When the user click submit, it will go to another page. But it seems like there's no $_post, $_get, or $_REQUEST in the file. I also tried to delete name and value in the input tag, it still works. It also still works if I delete method, name and id in the form tag...

It doesn't work if I delete the form tag.

   <form method="post" name="my_form" id="50">form content
   <input type="submit" name="val1" value="value"></input>
   </form>

After delete method, name, and id it still works:

    <form>form content
   <input type="submit"></input>
   </form>

So my question is, is there other way you know that can be used in submitting a form? Thank you for your time.

Upvotes: 0

Views: 137

Answers (4)

jeroen
jeroen

Reputation: 91734

If the form still works when you remove all attributes from the form tag and you cannot find any references to $_POST, $_GET or $_REQUEST in the file(s) that get called, it is possible that register_globals is turned on (if you're not on php 5.4...).

That setting causes posted variables to be automatically converted to "normal" variables, like $val1 in your case.

If this is the case, it is highly recommended to turn it off and rewrite your code to use the "normal" super-globals (see the manual).

Upvotes: 0

Arthur Nicoll
Arthur Nicoll

Reputation: 391

I think Jeffrey may be right. It could be using Javascript or Ajax or JQuery or some combination of these. Look for an onSubmit event function linked to the form element or possibly an onClick event function linked to the Submit input element in the Javascript section of the page. This could easily be calling a document.{formelement}.submit(). Given it isn't working, it may even be doing a window.location() call to navigate to the other page without passing any data (eugh!!!) Shooting in the dark unless we can see more of the script.

Upvotes: 0

exussum
exussum

Reputation: 18550

if its not in that file (and remember to check ALL includes / requires)

Then the server is re writing it. Check your apache config files.

You can tell which page the form is being submitted to by using a tool like firebug. But the look of the code is its being submitted to the page its currently on

Upvotes: -1

Shoe
Shoe

Reputation: 76240

Your code is probably using an AJAX request instead of the classic form submitting method. If you notice there's no action attribute in the form HTML tag and instead there's an id attribute which can be easily used to select the item via Javascript.

For example in jQuery:

$('#50')...

Upvotes: 4

Related Questions