Jump to content

how to check button existance in php.


VineetDubey

Recommended Posts

But after adding form tag still it is not working why?

Thanks for your reply

<?php

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

{

echo "working";

}

?>

<html>

<body>

<form method='post'>

<input type='Button' name='btn' id='btn' value='Button'>

</form>

</body>

</html>

This action is also not working

Now i have two file one is check.php and test.php

In test.php

{

<html>

<body>

<form method='post' action='check.php'>

<input type='Button' name='btn' id='btn' value='Button'>

</form>

</body>

</html>

}

In check.php

{

<?php

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

{

  echo "working";

}

?>

}

Please help me.I want to know how can i check button click in php.

this is working where we replace button with submit button.

like

<?php

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

{

  echo "working";

}

?>

<html>

<body>

<form method='post'>

<input type='submit' name='btn' id='btn' value='Button'>

</form>

</body>

</html>

You don't need to make two files, simply make the action attribute point to its own file, i. e. in test.php: <form action="test.php" method="post">

Additionally, if you only want to check whether the form was submitted, it's better to use

if($_SERVER['REQUEST_METHOD'] == "POST") {}

(see http://www.vbforums.com/showthread.php?t=562749 )

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.