Hello.

I am trying to create a registeration system on my website using PHP and MySQL. BUt whenever I put <?php ?> tags and start coding and test it, I get this error

Parse error: syntax error, unexpected T_STRING on line 39

Here is my code:

<?php

            $form = "<form method="post" action="signup-p.php" id="signupform">
                <div class="form">
                <div class="fieldset">
            <input name="signup_form" type="hidden" />
            <div class="input">
                <label for="username">Username</label>
                <input type="text" name="user" id="username" value="" />
            </div>
            <div class="input">
                <label for="email">E-mail</label>
                <input type="text" name="email" id="email" value="" />
            </div>
            <div class="input">
                <label for="email_confirm">Confirm E-mail</label>
                <input type="text" name="email_confirm" id="email_confirm" value="" />
            </div>
            <div class="input">
                <label for="password">Password</label>
                <input type="password" name="password" id="password" />
            </div>
            <div class="input">
                <label for="password_confirm">Confirm password</label>
                <input type="password" name="password_confirm" id="password_confirm" />
            </div>     
        </div>
        <div class="button"><strong><input type="submit" class="submit" name="registerbtn" value="Sign up" /></strong></div>
    </div>
    </form>"

    ?>

The code error on line 39:

$form = "<form method="post" action="signup-p.php" id="signupform">

If you need more details, let me know. Please help me fix the issue.

Thanks.
Hassan.

Recommended Answers

All 9 Replies

<form method="post" action="signup-p.php" id="signupform">
<div class="form">
<div class="fieldset">
<input name="signup_form" type="hidden" />
<div class="input">
<label for="username">Username</label>
<input type="text" name="user" id="username" value="" />
</div>
<div class="input">
<label for="email">E-mail</label>

I would suggest changing all the " used in this to '

<?php
$form = "<form method='post' action='signup-p.php' id='signupform'>
<div class='form'>
<div class='fieldset'>
<input name='signup_form' type='hidden' />
<div class='input'>
<label for='username'>Username</label>
<input type='text' name='user' id='username' value='' />
</div>
<div class='input'>
<label for='email'>E-mail</label>
<input type='text' name='email' id='email' value='' />
</div>
<div class='input'>
<label for='email_confirm'>Confirm E-mail</label>
<input type='text' name='email_confirm' id='email_confirm' value='' />
</div>
<div class='input'>
<label for='password'>Password</label>
<input type='password' name='password' id='password' />
</div>
<div class='input'>
<label for='password_confirm'>Confirm password</label>
<input type='password' name='password_confirm' id='password_confirm' />
</div>
</div>
<div class='button'><strong><input type='submit' class='submit' name='registerbtn' value='Sign up' /></strong></div>
</div>
</form>";
?>

You also have not terminated your php usng ;

Thank you, now I don't get any errors. But actually I don't see the form now. Its blank.

If you're changing all the single quotes to double, you need to change the double to single.

$form = '<div class="button">...</div>';

I changed all single to double and all double to single but still no luck.

$form = "<form method='post' action='signup-p.php' id='signupform'>

sorry missed this one. add an echo:

`$form = echo "<form method='post' action='signup-p.php' id='signupform'>

I added the echo function, and then I got this:

Parse error: syntax error, unexpected T_ECHO

How are you showing this?

    <?php
    $form = "<form method='post' action='signup-p.php' id='signupform'>
    <div class='form'>
    <div class='fieldset'>
    <input name='signup_form' type='hidden' />
    <div class='input'>
    <label for='username'>Username</label>
    <input type='text' name='user' id='username' value='' />
    </div>
    <div class='input'>
    <label for='email'>E-mail</label>
    <input type='text' name='email' id='email' value='' />
    </div>
    <div class='input'>
    <label for='email_confirm'>Confirm E-mail</label>
    <input type='text' name='email_confirm' id='email_confirm' value='' />
    </div>
    <div class='input'>
    <label for='password'>Password</label>
    <input type='password' name='password' id='password' />
    </div>
    <div class='input'>
    <label for='password_confirm'>Confirm password</label>
    <input type='password' name='password_confirm' id='password_confirm' />
    </div>
    </div>
    <div class='button'><strong><input type='submit' class='submit' name='registerbtn' value='Sign up' /></strong></div>
    </div>
    </form>";

    echo $form;

    ?>

Works without iss or error

Thanks squidge, working fine as it should now. Thanks a lot.

Thanks squidge, working fine as it should now. Thanks a lot

No problems, sorry for the previous error of mine. Been a long day :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.