alanl1 Posted June 11, 2013 Share Posted June 11, 2013 I have a form <form method='POST' name="myform" action="test.php?filename=$filename" > when I try to retrieve the variable I get nothing. My browser just shows this http://localhost/test.php?filename=$filename $newfilename = $_POST[$filename]; echo " the filename is ".$newfilename; the filename is Link to comment https://forums.phpfreaks.com/topic/279020-variable-not-passing-through/ Share on other sites More sharing options...
requinix Posted June 11, 2013 Share Posted June 11, 2013 You can't use variables in literal HTML and just expect PHP to know that you want it replaced. You have to use PHP code for it. Link to comment https://forums.phpfreaks.com/topic/279020-variable-not-passing-through/#findComment-1435255 Share on other sites More sharing options...
alanl1 Posted June 11, 2013 Author Share Posted June 11, 2013 wow that was fast. i have tried that which sort of works, it shows in the browser ok now I still cannot seem to echo this out on the next page though, am i doing something else wrong $newfilename = $_POST[$filename]; echo " the filename is ".$newfilename; Link to comment https://forums.phpfreaks.com/topic/279020-variable-not-passing-through/#findComment-1435256 Share on other sites More sharing options...
AbraCadaver Posted June 11, 2013 Share Posted June 11, 2013 $newfilename = $_POST['filename']; Link to comment https://forums.phpfreaks.com/topic/279020-variable-not-passing-through/#findComment-1435259 Share on other sites More sharing options...
alanl1 Posted June 11, 2013 Author Share Posted June 11, 2013 ok ive done that <?php $newfilename = $_POST['filename'];echo " the filename is ".$newfilename; ?> and it still shows nothing, I can see it in the browser http://localhost/test.php?filename=Synergy_SARnew.csv Link to comment https://forums.phpfreaks.com/topic/279020-variable-not-passing-through/#findComment-1435273 Share on other sites More sharing options...
requinix Posted June 11, 2013 Share Posted June 11, 2013 Nothing as in an empty filename? $_POST is for forms with $_GET is for URLs. That's the one you want to use. Link to comment https://forums.phpfreaks.com/topic/279020-variable-not-passing-through/#findComment-1435284 Share on other sites More sharing options...
alanl1 Posted June 11, 2013 Author Share Posted June 11, 2013 thanks that works Link to comment https://forums.phpfreaks.com/topic/279020-variable-not-passing-through/#findComment-1435434 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.