Home > Software design >  Is is possible to use the submit ID value in PHP
Is is possible to use the submit ID value in PHP

Time:10-08

name="submit" works normally like it should

if(isset($_POST["submit"]))

<input type="submit" ID="asdf" name="submit" value="Save" > 

I will like to use the ID element instead

if(isset($_POST["asdf"]))

<input type="submit" ID="asdf" name="submit" value="Save" >

i dont know how to do this, i have tried if(isset($_POST["#asdf"])) no luck

CodePudding user response:

IDs are not passed in a form submission. You can, however, have multiple <input type="submit"> fields with different names, and act accordingly.

<input type="submit" name="asdf" value="Save" > 

will give you a $_POST['asdf'] with value Save.

CodePudding user response:

No, you cannot access the ID of the element in the $_POST array, only the name. If you do this:

print_r( $_POST )

You will see the key that can be accessed, and their values.

  • Related