0

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.

3
Contributors
9
Replies
10
Views
5 Years
Discussion Span
Last Post by Squidge
1

<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 ;

0

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

0

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

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

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

0

$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'>

0

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

Parse error: syntax error, unexpected T_ECHO

0

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

0

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

0

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

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.