Jump to content

php in html which is echo'd in php?


fredted40x

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.