I have a kinda weird situation where I have to access a variable once the submit button is entered. here is the code which am working on...
echo '<form>';
echo '<input type="submit" name="report1" value="submit"></button>';
echo '<input type="text" name="inp1" id="inp1"></input>';
echo '<input type="text" name="inp2" id="inp2"></input>';
$ean = $_POST['inp1'] ;
$url = $_POST['inp2'] ;
if (isset($_POST['report']))
{
if ($ean=='0')
{
//do nothing
}
else
{
echo echo '<input type="submit" name="report2" value="submit"></button>';
}
}
if (isset($_POST['report2']))
{
$ean = "xyz";
echo $ean;
}
echo '</form>';
SO, here while clicking on the the Button name report2 I want to access the $ean and $url variables but its showing null means the variables are not storing the value input in the inp1 and inp2 input box...can any one please suggest me what to do.
By the help of the comments posted here I did the following trick and it works for me...
echo '<input type="hidden" name="hidTitle" value="'.$ean.'" />';
and access this variable by _POST['hidTitle']
and it works for me