Jump to content

error on syntax


angelsRock

Recommended Posts

<?php if ( strlen($row[username])>1 )  ?>
            
		<input type="text" name="name" size="31" value=<?php   echo $row[name];?>> 

		<?php else ?>
		<input type="text" name="name" size="31" value=<?php if (isset($_POST[name])) echo $_POST[name];?>>

 

the error is on

Parse error: syntax error, unexpected T_ELSE in ...

why?

Link to comment
https://forums.phpfreaks.com/topic/73090-error-on-syntax/
Share on other sites

use either

<?php if( strlen($row[username])>1 ): ?>
  <input type="text" name="name" size="31" value=<?php echo $row[name];?>>			
<?php else: ?>
  <input type="text" name="name" size="31" value=<?php if (isset($_POST[name])) echo $_POST[name];?>>
<?php endif; ?>

 

or

<?php if( strlen($row[username])>1 ){ ?>
  <input type="text" name="name" size="31" value=<?php echo $row[name];?>>			
<?php } else { ?>
  <input type="text" name="name" size="31" value=<?php if (isset($_POST[name])) echo $_POST[name];?>>
<?php } ?>

Link to comment
https://forums.phpfreaks.com/topic/73090-error-on-syntax/#findComment-368596
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.