fredted40x Posted April 16, 2010 Share Posted April 16, 2010 Hi, I'm trying to set a text fields value to a $_GET value, I've managed to do it in HTML and PHP using <form action="formsubmit.php?id=$_GET[id]" method="POST"> <input type="text" value="<?php echo $_GET[id]; ?>" name="showid"> <input type="submit" value="Submit"> </form> This works fine, but when i try and echo the form out in php it doesn't get the id, if (isset($_SESSION['user'])) { echo('<form action="formsubmit.php?id=$_GET[id]" method="POST"> <input type="text" value="<?php echo $_GET[id]; ?>" name="showid"> <input type="submit" value="Submit"> </form>'); } Not matter what i try i cant get it to get the id and not just set the value to the code. Is it possible to do PHP inside HTML that's inside PHP? Thanks Link to comment https://forums.phpfreaks.com/topic/198738-php-in-html-which-is-echod-in-php/ Share on other sites More sharing options...
JAY6390 Posted April 16, 2010 Share Posted April 16, 2010 echo('<form action="formsubmit.php?id='.$_GET['id'].'" method="POST"> <input type="text" value="'.$_GET['id'].'" name="showid"> <input type="submit" value="Submit"> </form>'); Link to comment https://forums.phpfreaks.com/topic/198738-php-in-html-which-is-echod-in-php/#findComment-1042981 Share on other sites More sharing options...
fredted40x Posted April 16, 2010 Author Share Posted April 16, 2010 echo('<form action="formsubmit.php?id='.$_GET['id'].'" method="POST"> <input type="text" value="'.$_GET['id'].'" name="showid"> <input type="submit" value="Submit"> </form>'); That's great! Would have never got that. Thank you! Link to comment https://forums.phpfreaks.com/topic/198738-php-in-html-which-is-echod-in-php/#findComment-1042991 Share on other sites More sharing options...
JAY6390 Posted April 16, 2010 Share Posted April 16, 2010 no problem Link to comment https://forums.phpfreaks.com/topic/198738-php-in-html-which-is-echod-in-php/#findComment-1042992 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.