Current location: Hot Scripts Forums » Programming Languages » PHP » Fixing a Simple error on my script. Plz help


Fixing a Simple error on my script. Plz help

Reply
  #1 (permalink)  
Old 06-28-09, 05:03 PM
DarkestSoul DarkestSoul is offline
Newbie Coder
 
Join Date: Jun 2009
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Fixing a Simple error on my script. Plz help

PHP Code:

[28-Jun-2009 13:20:01PHP Parse error:  syntax errorunexpected T_STRINGexpecting ']' in /home/assassi1/public_html/John's Script/Register.php on line 46 



the line is
PHP Code:

<td width="100%"><label>Last Name: <input type="text" name="lastname" size="25" value="<? echo $_POST[lastname]; ?>"></label></td>
does anyone know how to fix this.
Thank You all for trying
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 06-28-09, 06:49 PM
Jcbones Jcbones is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: North Carolina, USA
Posts: 516
Thanks: 5
Thanked 47 Times in 44 Posts
No errors on that line. Post lines before and after this line.

I promise no-one will steal your code... And if they do, then you can just be glad you are contributing to this little community. Just like you want someone to do for yourself.

BTW, no reason to double post.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 06-28-09, 07:20 PM
DarkestSoul DarkestSoul is offline
Newbie Coder
 
Join Date: Jun 2009
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Jcbones View Post
No errors on that line. Post lines before and after this line.

I promise no-one will steal your code... And if they do, then you can just be glad you are contributing to this little community. Just like you want someone to do for yourself.

BTW, no reason to double post.
PHP Code:

<?php


// Check if he wants to register:
if (!empty($_POST[username]))
{
    
// Check if passwords match.
    
if ($_POST[password] != $_POST[password2])
        exit(
"Error - Passwords don't match. Please go back and try again.");

    
// Assign some variables.
    
$date mktime("d - m - Y");
    
$ip $_SERVER[REMOTE_ADDR];

    require_once(
"connect.php");

    
// Register him.
    
$query mysql_query("INSERT INTO members 
    (username, firstname, lastname, password, date, ip)
    VALUES    ('
$_POST[username]','$_POST[firstname]','$_POST[lastname]','$_POST[password]','$date','$ip')")
    or die (
"Error - Couldn't register user.");
    
    echo 
"Welcome $_POST[username]! You've been successfully reigstered!<br /><br />
        Please login <a href='login.php'><b>here</b></a>."
;
    exit();
}

?>

<html>
    <head>
        <title>Register</title>
    </head>
    <body>
        <form action="register.php" method="post">
            <table width="75%" border="1" align="center" cellpadding="3" cellspacing="1">
                <tr>
                    <td width="100%"><h5>Registration</h5></td>
                </tr>
                <tr>
                    <td width="100%"><label>Desired Username: <input type="text" name="username" size="25" value="<? echo $_POST[username]; ?>"></label></td>
                </tr>
                <tr>
                    <td width="100%"><label>First Name: <input type="text" name="firstname" size="25" value="<? echo $_POST[firstname]; ?>"></label></td>
                </tr>
                <tr>
                    <td width="100%"><label>Last Name: <input type="text" name="lastname" size="25" value="<? echo $_POST[lastname]; ?>"></label></td>
                </tr>
                <tr>
                    <td width="100%"><label>Password: <input type="password" name="password" size="25" value="<? echo $_POST[password]; ?>"></label></td>
                </tr>
                <tr>
                    <td width="100%"><label>Verify Password: <input type="password" name="password2" size="25" value=""></label></td>
                </tr>
                <tr>
                    <td width="100%"><input type="submit" value="Register!"></td>
                </tr>
            </table>
        </form>
    </body>
</html>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 06-28-09, 07:59 PM
=OTS=G-Man =OTS=G-Man is offline
Newbie Coder
 
Join Date: Jun 2009
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Works fine on my test server, only thing changed was comment out

require_once("connect.php");
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 06-28-09, 11:14 PM
Jcbones Jcbones is offline
Aspiring Coder
 
Join Date: Mar 2009
Location: North Carolina, USA
Posts: 516
Thanks: 5
Thanked 47 Times in 44 Posts
It's working for me as well. I don't get any parse errors.

The only thing that my test server doesn't like are the short tags.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 06-28-09, 11:33 PM
job0107's Avatar
job0107 job0107 is offline
Community Liaison
 
Join Date: Dec 2006
Location: Tacoma, Washington USA
Posts: 3,454
Thanks: 0
Thanked 140 Times in 137 Posts
I don't get any syntax errors either,
but you do have a problem with your code.

This line of code will give you a fatal error:
PHP Code:

$date mktime("d - m - Y"); 

mktime() requires a numeric value and you are trying to assign it a string.

It needs to be like this:
PHP Code:

$date mktime(date("d - m - Y")); 

__________________
Jerry Broughton
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Raffle/Lottery Script (Very profitable!), Coded it myself. Voltaire General Advertisements 6 03-16-09 08:15 AM
Submit button....can it send info to my email w/out the use of php???? lisa33 HTML/XHTML/XML 7 10-17-06 12:46 PM
i need this script (Xtreme UsersOnline 1.0) plz plz hossamhamdi1986 Script Requests 0 09-04-06 11:43 AM
Need a simple auction script installed caver911 Job Offers & Assistance 1 08-03-05 03:11 PM
Seeking for a simple photo gallery script... Sgrebs PHP 0 10-27-03 03:00 PM


All times are GMT -5. The time now is 12:36 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.