Jump to content

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 )

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.