-1

I need to display a form through PHP, but I don't want to use the "echo" function or the "print" method. This is a user registration form. But I am having trouble using the two mentioned methods. My code:

<?Php
if(!isset($_SESSION['userid'])){
<form> 
 //My form here... 
</form>
exit;
}else{
<form> 
 //My other form here... 
</form>
?>
Funk Forty Niner
  • 74,450
  • 15
  • 68
  • 141
Don Benito
  • 31
  • 4

1 Answers1

1

You can do the following:

<?php if (!isset($_SESSION['userid'])) { ?>
<form>
...
</form>
<?php } else { ?>
<form>
...
</form>
<?php } ?>

...or with alternative syntax for control structures:

<?php if (!isset($_SESSION['userid'])): ?>
<form>
...
</form>
<?php else: ?>
<form>
...
</form>
<?php endif; ?>
moliata
  • 28
  • 2
  • 9