design issue..

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kelvingeorge
Forum Newbie
Posts: 7
Joined: Fri Feb 22, 2008 3:57 pm

design issue..

Post 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]
Last edited by RobertGonzalez on Fri Feb 22, 2008 4:32 pm, edited 1 time in total.
Reason: Changed the text color, added code tags.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Re: design issue..

Post 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?
kelvingeorge
Forum Newbie
Posts: 7
Joined: Fri Feb 22, 2008 3:57 pm

Re: design issue..

Post 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
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: design issue..

Post 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 :)
kelvingeorge
Forum Newbie
Posts: 7
Joined: Fri Feb 22, 2008 3:57 pm

Re: design issue..

Post 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
Post Reply