如何将带有php标签的字符串放入php变量?

I want to include

action="<?php echo $_SERVER['PHP_SELF']; ?>"

in $render_form variable. But the following code does not work:

<?php $render_form = '<form method="post" action="<?php echo 
  $_SERVER['PHP_SELF']; ?>">
  <input type="text" name="name">
  <br>
  <input type="submit" name="submit" value="Submit Form">
  <br> 
  </form>'; 
?>

The following code (without php tag) works:

<?php $render_form = '<form method="post" action="">
  <input type="text" name="name">
  <br>
  <input type="submit" name="submit" value="Submit Form">
  <br>
  </form>'; 
?>

If I understood you, this should fit your issue

<?php $render_form = '<form method="post" action="'. $_SERVER['PHP_SELF'] .'">
  <input type="text" name="name">
  <br>
  <input type="submit" name="submit" value="Submit Form">
  <br> 
  </form>'; 
?>