Theon
Theon

Reputation: 9

fetching value with the submit button in HTML?

If the submit button is pressed in HTML I need to send some value with it. How can I do it?

<input type="submit" name="ask" class="tbutton" value="ask" />

if(isset($_POST['ask'])){
    // i need to fetch some value that is passed with submit button }

Upvotes: 0

Views: 134

Answers (1)

Arjun Bala
Arjun Bala

Reputation: 287

I think you want to fetch value of some input right?

may be this will help

<form method="post">
 <input type="text" name="myText" />
 <input type="submit" name="ask" class="tbutton" value="ask" />
</form>

<?php
   if(isset($_POST['ask'])){
      echo($_POST['myText']);
   }
?>

Upvotes: 2

Related Questions