Title: parse error (;)
Last modified: November 23, 2016

---

# parse error (;)

 *  Resolved [charlesp123](https://wordpress.org/support/users/charlesp123/)
 * (@charlesp123)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/parse-error-418/)
 * I can’t figure this out … I have a simple php code
    here: $error=””; // Variable
   To Store Error Message if (isset($_POST[‘submited’])) { if (empty($_POST[‘username’])
   || empty($_POST[‘password’])) { $error= “Utilisateur ou Mot de passe invalide”;}
   else { $username=$_POST[‘username’]; $password=$_POST[‘password’]; $username 
   = stripslashes($username); $password = stripslashes($password);
 * if ($username == “XXXX” && $password == “XXXX”) {
    $_SESSION[‘login_user’]=$username;//
   Initializing Session header(“location: [http://mysite.ca/fr/$username&#8221](http://mysite.ca/fr/$username&#8221););//
   Redirecting To Other Page } else { $error= “Utilisateur ou Mot de passe invalide”;}}}/////
   fin user login
 * there is no error with that code right ? well I got this :
    Parse error: syntax
   error, unexpected ‘;’ in …mysite/wp-content/plugins/insert-php/insert_php.php(
   48) : eval()’d code on line 17
 * I tried everything im thinking about an other way to insert php …what do u suggest?
    -  This topic was modified 9 years, 4 months ago by [charlesp123](https://wordpress.org/support/users/charlesp123/).

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * (@willbontrager)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/parse-error-418/#post-8473182)
 * Charles, like you, I don’t see an error. But it’s there, on line 17, or the parser
   wouldn’t flag it. Maybe something earlier affects quotes or parenthesis.
 * Perhaps a change was made in the WordPress edit box.
 * Copy the code directly from your WordPress edit box and paste it into a reply.
   And use the “code” button above the support editing box so your code is properly
   formatted. I’ll paste it into my dev WP installation and see what I can see.
 * Will
 *  Thread Starter [charlesp123](https://wordpress.org/support/users/charlesp123/)
 * (@charlesp123)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/parse-error-418/#post-8477592)
 * [insert_php]
    /// user login ///
 * session_start(); // Starting Session
    $error=””; // Variable To Store Error Message
   if (isset($_POST[‘submited’])) { if (empty($_POST[‘username’]) || empty($_POST[‘
   password’])) { $error= “Utilisateur ou Mot de passe invalide”; } else { $username
   =$_POST[‘username’]; $password=$_POST[‘password’]; $username = stripslashes($
   username); $password = stripslashes($password);
 * if ($username == “groupesanteducore” && $password == “admin”) {
    $_SESSION[‘login_user’]
   =$username; // Initializing Session header(“location: [http://mysite/fr/$username&#8221](http://mysite/fr/$username&#8221););//
   Redirecting To Other Page } else { $error= “Utilisateur ou Mot de passe invalide”;}}}/////
   fin user login [/insert_php] <div style=”margin: auto; width: 300px;”><form method
   =”post”> <div class=””><label><b>Username</b></label> <input name=”username” 
   type=”text” placeholder=”Enter Username” /></div> <label><b>Password</b></label
   > <input name=”password” type=”password” placeholder=”Enter Password” />
 * <button name=”submited” type=”submit”>Envoyer</button>
    [insert_php]echo $error;[/
   insert_php]
 * (If I put this code into a template page it is all working) but since I want 
   it to “echo” any errors it doesn’t speak with [insert_php]echo $error;[/insert_php]
   when placed into the template thaw why I want to use insert php) any help ?
    
   </form></div>
 *  Thread Starter [charlesp123](https://wordpress.org/support/users/charlesp123/)
 * (@charlesp123)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/parse-error-418/#post-8477665)
 * oh and I use this with visual composer.
 *  [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * (@willbontrager)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/parse-error-418/#post-8477733)
 * Hi Charles,
 * Thanks for telling me you’re using Visual Composer. It makes a different. That
   plugin does seem to provide grief for Insert PHP users, changing things even 
   when they’re pasted in with the “Text” tab instead of the “Visual” tab. For example,
   it might expand `"&"` into `"& amp;"` (which would provide an unexpected semicolon).
   You could try using “and” instead of “&” and see if it will get you past that
   point.
 * Regarding `[insert_php]echo $error;[/insert_php]`: $error probably won’t be accessible
   at that point. Variables aren’t carried from one [insert_php] block to another[
   insert_php] block. See [http://www.willmaster.com/software/WPplugins/insert-php-wordpress-plugin-instructions.php#inandofitself](http://www.willmaster.com/software/WPplugins/insert-php-wordpress-plugin-instructions.php#inandofitself)
 * Will
    -  This reply was modified 9 years, 4 months ago by [WillBontrager](https://wordpress.org/support/users/willbontrager/).
    -  This reply was modified 9 years, 4 months ago by [WillBontrager](https://wordpress.org/support/users/willbontrager/).
    -  This reply was modified 9 years, 4 months ago by [WillBontrager](https://wordpress.org/support/users/willbontrager/).
    -  This reply was modified 9 years, 4 months ago by [WillBontrager](https://wordpress.org/support/users/willbontrager/).
    -  This reply was modified 9 years, 4 months ago by [WillBontrager](https://wordpress.org/support/users/willbontrager/).
 *  [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * (@willbontrager)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/parse-error-418/#post-8477759)
 * The system won’t let me do any more edits to the above reply.
 * The reason the “&” and the “amp;” have a space between them is because the rendering
   engine won’t print the HTML ampersand entity, insisting on changing it to “&”,
   even when it’s put into a ‘code’ block.
 * Just venting frustration 🙁
 * Oh, and
    `using “and” instead of “&”` in the above reply should read `using “
   and” instead of “&&”`
 * Will
    -  This reply was modified 9 years, 4 months ago by [WillBontrager](https://wordpress.org/support/users/willbontrager/).
    -  This reply was modified 9 years, 4 months ago by [WillBontrager](https://wordpress.org/support/users/willbontrager/).
    -  This reply was modified 9 years, 4 months ago by [WillBontrager](https://wordpress.org/support/users/willbontrager/).
 *  Thread Starter [charlesp123](https://wordpress.org/support/users/charlesp123/)
 * (@charlesp123)
 * [9 years, 4 months ago](https://wordpress.org/support/topic/parse-error-418/#post-8477816)
 * aha OMG you are right it does add amp; but using “and” just solved the problem
   it is working now thank you ! and yes my error in the second [insert_php]echo
   $error;[/insert_php] is working too 😛
 * thx very much !

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘parse error (;)’ is closed to new replies.

 * ![](https://ps.w.org/insert-php/assets/icon-256x256.gif?rev=3475630)
 * [Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts](https://wordpress.org/plugins/insert-php/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-php/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-php/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-php/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-php/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-php/reviews/)

## Tags

 * [parse-error](https://wordpress.org/support/topic-tag/parse-error/)

 * 6 replies
 * 2 participants
 * Last reply from: [charlesp123](https://wordpress.org/support/users/charlesp123/)
 * Last activity: [9 years, 4 months ago](https://wordpress.org/support/topic/parse-error-418/#post-8477816)
 * Status: resolved