Ramasamy Raja
Ramasamy Raja

Reputation: 139

PHP - Not able to get Text field value

I am new to PHP, I have mentioned below my HTML and PHP codes. I am not able to get the textbox value to PHP. I have mentioned below both HTML and PHP codes.

HTML Code:

Section <input type="text" name="f_b1_s1_sec" id="f_b1_s1_sec">
Content <input type="text" name="f_b1_s1_con" id="f_b1_s1_con"><br><br> 
Para <input type="text" name="f_b1_s1_para" id="f_b1_s1_para">

PHP Code:

$tx0 = $_POST["f_b1_s1_sec"];
$tx1 = $_POST["f_b1_s1_con"];
$tx2 = $_POST["f_b1_s1_para"];

Please Clarify.

Thank you!

Upvotes: 1

Views: 591

Answers (1)

Shlomo
Shlomo

Reputation: 3990

Try this:

<?php
if( isset( $_POST["go"] ) {
  $tx0 = $_POST["f_b1_s1_sec"];
  $tx1 = $_POST["f_b1_s1_con"];
  $tx2 = $_POST["f_b1_s1_para"];
}
?>

<form action="insertyourphp.php" method="post">
Section <input type="text" name="f_b1_s1_sec" id="f_b1_s1_sec">
Content <input type="text" name="f_b1_s1_con" id="f_b1_s1_con"><br><br> 
Para <input type="text" name="f_b1_s1_para" id="f_b1_s1_para">
<input type="submit" name="go" value="Go">
</form>

Upvotes: 2

Related Questions