Board index   FAQ   Search  
Register  Login
Board index PHP PHP Scripts

Login Script

Links for php scripts

Moderators: macek, egami, gesf

Login Script

Postby ms4sman » Sat Sep 15, 2012 5:36 pm

Hello all, I have been working on a website which requires users to log in. I have been having nothing but fits with it. I used Kompozer to create the HTML code, and now I am entering the php code for logging in. When I use this code (ther is more to the page of course) i get this error:
Parse error: syntax error, unexpected T_STRING in index.php on line 14 (line 14 is the line where the form begins)
All i have done is added the php code brackets at the beginning and end and it throws everything into a tizzy!
Again, I am a very new PHP user: please help me :) Thanks!

Code: Select all
<?php
<form method="post" action="login.php" name="login"><span style="font-weight: bold; color: rgb(51, 255, 255);">Sign In</span><br>
Email Address: <input name="email"><br>
Password: <input name="password" type="password"><br>
<input value="Login" name="login" type="submit"></form>
?>
ms4sman
New php-forum User
New php-forum User
 
Posts: 8
Joined: Sat Sep 08, 2012 7:24 pm

Re: Login Script

Postby dering » Tue Sep 18, 2012 6:31 am

You seem to be placing HTML code inside your PHP script. As a new PHP programmer, I have made similar errors. Here of some examples of how I have made this work.

echo 'HTML Code in here of any type';
echo 'You said your favorite color was' . $color . '. That is a nice color!';

Be sure to surround your HTML stuff with single quotes. The . concatenates the text to put them together like they are one string.
dering
New php-forum User
New php-forum User
 
Posts: 5
Joined: Tue Sep 18, 2012 5:59 am

Re: Login Script

Postby ms4sman » Tue Sep 18, 2012 2:00 pm

Thank you for your reply! Your reply definitely makes sense putting things into a print statement. I will try that and get back to you!
ms4sman
New php-forum User
New php-forum User
 
Posts: 8
Joined: Sat Sep 08, 2012 7:24 pm

Re: Login Script

Postby freshnet » Tue Sep 18, 2012 3:18 pm

In this case, it's probably better to end your php code and then put in the html for your form, e.g.

Code: Select all
<?php
some php code
?>
some html code
<?php
some more php code
?>
User avatar
freshnet
php-forum Active User
php-forum Active User
 
Posts: 252
Joined: Tue Feb 22, 2011 8:19 am
Location: Canada

Re: Login Script

Postby BrianAlan » Wed Sep 26, 2012 5:47 pm

definitely makes sense putting things into a print statement. I will try that and get back to you!





--------------------------
http://www.wholesaledvdsales.co.uk/
BrianAlan
New php-forum User
New php-forum User
 
Posts: 6
Joined: Mon Aug 13, 2012 2:03 am

Re: Login Script

Postby ms4sman » Thu Sep 27, 2012 3:27 am

I'm sorry, but I have been very busy lately and haven't had the time to work on this project much. I do still plan to try some things and get back to those who helped me without any sarcasm.
ms4sman
New php-forum User
New php-forum User
 
Posts: 8
Joined: Sat Sep 08, 2012 7:24 pm

Re: Login Script

Postby kiash001 » Thu Feb 28, 2013 9:32 pm

Separate php and html codes like this way.

<?php
//my php codes
echo 'hello world';
?>

<html>
<head>
</head>
<body>
<?php echo 'inside html';?>
</body>
</html>
User avatar
kiash001
New php-forum User
New php-forum User
 
Posts: 16
Joined: Wed Feb 27, 2013 2:49 am
Location: Dhaka, Bangladesh


Return to PHP Scripts

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.