Page 1 of 1

design issue..

Posted: Fri Feb 22, 2008 4:19 pm
by kelvingeorge
Mod | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hey there forum,

I'm new to php, please help me out in fixing this.. I'm having a problem with user register form..

Code: Select all

<form name="form1" method="post" action="<?php echo $_SERVER[PHP_SELF];?">
...............
<input type="button" name="reset" value="Reset" onclick=""/>
<input name="sbt-reg" type="submit" value="Register"/></td>
<?php
    if (isset($_POST['sbt-reg']))
    {
    if (!$_POST['Text2']|!$_POST['pwd1']|!$_POST['pwd2'])
    {
        die("Required field cannot be left blank! Click back on the browser button.");
    }
    $usercheck = $_POST['Text2'];
    $check = mysql_query("Select * from info where unm='$usercheck'") or die (mysql_error());
    $check2 = mysql_num_rows($check);
    if ($check2!=0)
    {
        die('Sorry, the username '.$_POST['Text2'].' is already in use');
    }
    if ($_POST['pwd1']!=$_POST['pwd2'])
    {
        die("Password and confirm password did not match! Click back on the browser button.");
    }
    $add_member = mysql_query("Insert into info(unm,psw) values ('".$_POST['Text2']."','".$_POST['pwd2']."')");
?>
After this the remain html part is not seen, the page aligns to right, and the footer is gone.. how do I fix this?


Mod | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Re: design issue..

Posted: Fri Feb 22, 2008 4:33 pm
by RobertGonzalez
What is actually showing to the screen? Did you view the source to make sure the markup is rendering as it is supposed to?

Re: design issue..

Posted: Fri Feb 22, 2008 5:44 pm
by kelvingeorge
Its shows

Code: Select all

<td class="footer">&nbsp;</td>
            </tr>
            <tr>
                <td id="ft2">.....</td>
            </tr>
Required field cannot be left blank! Click back on the browser button.
After that it does not show anything in the source.. 8O

Re: design issue..

Posted: Fri Feb 22, 2008 5:48 pm
by alex.barylski

Code: Select all

die("Required field cannot be left blank! Click back on the browser button.");
Is stopping your script and preventing any further HTML from being output...

Do this:

Code: Select all

echo "Required field cannot be left blank! Click back on the browser button.";
p.s-You probably should read up on buffering to accomplish the task...

Cheers :)

Re: design issue..

Posted: Fri Feb 22, 2008 6:08 pm
by kelvingeorge
I did try that, the problem is it executes the next if block and a blank field is inserted into the db. I'm reading about output buffering.. Thanks