I wanted to store value of a echo into php variable but only i get is the HTML tag not actual value that hold that tag.
Javascript
function openModal()
{
var checked=false;
var elements = document.getElementsByName("offer[]");
for(var i=0; i < elements.length; i++)
{
if(elements[i].checked)
{
ele=elements[i].value;
alert(ele);
checked = true;
}
}
document.getElementById('test').innerHTML=ele;
}
PHP
ob_start();
echo "<label id='testH1'></label>";
$myStr = ob_get_contents();
ob_end_clean();
when i access the $myStr using 'echo "My String ".$myStr;'
it will display the actual value that id hold,but when i pass this $myStr to URL,It will again display echo "<label id='testH1'></label>"
I need to pass the value of $myStr to next page via url. How i can do?
You can do a redirection with get param, or send it via form and a $_POST.
With get param you can do :