pandu Posted December 15, 2010 Share Posted December 15, 2010 Im trying to make my form remember the last input made by user, so I wrote the following and I get a syntax error on the input line. The error is: Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\wamp\www\ezsynonym\index.php on line 90 <form id="searchform" method="post" action="index.php"> <input id="input" name="synonymsearch" type="text" value="<?php echo $_POST['synonymsearch']; ?>" maxlength="400px" /> </form> TIA Quote Link to comment https://forums.phpfreaks.com/topic/221706-parse-error-when-making-a-form-remember-last-user-input/ Share on other sites More sharing options...
.josh Posted December 15, 2010 Share Posted December 15, 2010 post more of the code around those lines. Quote Link to comment https://forums.phpfreaks.com/topic/221706-parse-error-when-making-a-form-remember-last-user-input/#findComment-1147493 Share on other sites More sharing options...
kaiman Posted December 15, 2010 Share Posted December 15, 2010 Try: <?php if (isset($_POST['synonymsearch'])) echo { $_POST ['synonymsearch']; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/221706-parse-error-when-making-a-form-remember-last-user-input/#findComment-1147496 Share on other sites More sharing options...
.josh Posted December 15, 2010 Share Posted December 15, 2010 that only looks to see if the variable is set. At most php would just give a notice. The error posted here means that somewhere in his code he isn't using quotes properly. But the code posted in and of itself is fine. So he needs to look around it. Quote Link to comment https://forums.phpfreaks.com/topic/221706-parse-error-when-making-a-form-remember-last-user-input/#findComment-1147531 Share on other sites More sharing options...
scotmcc Posted December 15, 2010 Share Posted December 15, 2010 It is possible that I've gone crazy, but the syntax looks a little busted to me: You wrote: <?php if (isset($_POST['synonymsearch'])) echo { $_POST ['synonymsearch']; } ?> I think it should be: <?php if (isset($_POST['synonymsearch'])) { echo $_POST ['synonymsearch']; } ?> What do you think? Quote Link to comment https://forums.phpfreaks.com/topic/221706-parse-error-when-making-a-form-remember-last-user-input/#findComment-1147552 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.