Reputation: 1090
So I have a PHP code similar to this
<?php
//some code here
?>
<form>
<input />
</form>
And according to this example, I want to get the input's content to use further in PHP and/or insert in the desired input some variables from my PHP code, how can I perform this?
Upvotes: 0
Views: 42
Reputation: 3093
You can post the data to php from a HTML form
<?php
// data is available in php POST array
var_dump($_POST);
// create a var to hold the post data
$sNameOfPostVar = "";
// if posted, set the var to the value of the posted content
if(isset($_POST['NameOfPostVar'])){
$sNameOfPostVar = $_POST['NameOfPostVar'];
}
?>
<!-- current action is blank to send to same page as php script -->
<form method='post' action=''>
<input name='NameOfPostVar' value='<?php echo $sNameOfPostVar;?>' />
</form>
Upvotes: 1