SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Jun 2003
    Location
    Earth
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question This code feels bad. but why?

    Below I have a sample of some code I messing with and the design "feels" wrong. I'm using includes to bring html in with out mixing to much php and html on the same page. I'm also running everything through the php engine because eventually I'll be adding a security check to each page. I'm not too worried about efficentcy right now as this is a proto type.

    ...but I feel the style is wrong.

    I'm really just looking for comments on what I'm generating...a little direction. I'm using style sheets for page organization and each column can is getting called individually.

    cheers,
    Leer


    PHP Code:
    <?php 

      
    //main_index.php 
    session_start(); 
        include_once 
    "header_module.php"
    if (isset(
    $_POST['submitlogin']) &amp;&amp; ($_POST['submitlogin'] = "login")) { 
        include_once 
    "game_module.php"
        include_once 
    "gamemenu_module.php"

    elseif (isset(
    $_POST['submitnew']) &amp;&amp; ($_POST['submitnew'] = "new account")) { 
           include_once 
    "newuser_module.php"

    else { 
         include_once 
    "menu_module.php"
         include_once 
    "resource_module.php"
         include_once 
    "news_module.php"

    include_once 
    "footer_module.php"
    ?> 


    -----new file  menu_module.php 

    form method="post" action="<?=$_SERVER['PHP_SELF']?>"> 
    <div id="left"> 
    <h2>Login</h2> 
    <h3> 
    <b>Username:</b><input size=8 tabindex=1 type="text" name="UserName"/><br> 
    <b>Password:</b><input size=8 tabindex=2 type="password" name="Password"/><br> 
    <input type="submit" name="submitlogin" value="login" />   <input type="submit" name="submitnew" value="new account" /> 
    </h3> 
    </div> 


    -----new file  newuser_module.php 

    <form method="post" action="newuser_module.php"> 

    <div id="main"> 

    <h2>New Account Setup</h2> 
    <h3> 
    <b>Username:</b><input size=15 tabindex=1 type="text" name="UserName"/><br> 
    <b>Display Name:</b><input size=15 tabindex=2 type="text" name="DisplayName"/><br> 
    <b>Password:</b><input size=8 tabindex=3 type="password" name="Password"/><br> 
    <b>Confirm Password:</b><input size=8 tabindex=4 type="password" name="Password2"/><br> 
    <b>Email:</b><input size=15 tabindex=5 type="text" name="email"/><br> 
    <b>Confirm Email:</b><input size=15 tabindex=6 type="text" name="email2"/><br> 

    <input type="submit" name="createnew" value="new account" /> 
    </h3>

  2. #2
    SitePoint Enthusiast webmasts's Avatar
    Join Date
    Apr 2003
    Location
    usa
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What problem are you having?

    From what i'm seeing, it will be better to use include("filename.php"); instead of include_once();?

    Make sure you save the index file as index.php

    You might also want to remove &amp;

    Hope this helps.

  3. #3
    SitePoint Member
    Join Date
    Jun 2003
    Location
    Earth
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually it runs fine. I was just wondering if I was developing a bad style as I don't see any other coders doing it anything like I have. Being new to coding I want to try and stick close to standard.

    The &amp was a cut a paste error.

    Thanks for the comments.

    cheers

  4. #4
    SitePoint Evangelist
    Join Date
    Nov 2001
    Location
    UK
    Posts
    466
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ($_POST['submitlogin'] = "login" )

    that is an assignment rather than a conditional

    use ==
    teckis - that's news to me.

  5. #5
    SitePoint Member
    Join Date
    Jun 2003
    Location
    Earth
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pootergeist
    ($_POST['submitlogin'] = "login" )

    that is an assignment rather than a conditional

    use ==

    ahh, yes...so it is! thanks.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •