1. Post #1
    Gold Member
    thirty9th's Avatar
    November 2006
    1,363 Posts
    I'm attempting to add a nice cover home page to a website that currently functions only as a database and data entry form.

    I have neither the knowledge nor the experience to mess around with PHP, so I'm wondering if I could simply design a webpage in HTML around this form without screwing it over. Here's what it looks like in bare-bones:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
    <html> 
      <title>Company Title</title> 
      <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> 
    </head> 
    <link href="style.css" rel="stylesheet" type="text/css" /> 
     
    <body> 
     <Br><Br> 
    <div  style="margin-left:20px; margin-top:20px; margin-right:0px; margin-bottom:0px"> 
    <form  action="login.php"  enctype="multipart/form-data" method="POST"> 
    	<input type="submit" value="LOG IN >>" class="button3"> 
    </form> 
     
    </div> 
     
     
     
     
     
    </body> 
    </html>
    When one clicks the LOG IN button, it creates several forms and drop-down menus that allow the user to enter data.

    However, will I be able to design a simple HTML page around this? Or will the PHP scripts attempt to create the forms all over the place? I'm not quite sure how it works.

  2. Post #2
    kill yourself
    Protocol7's Avatar
    June 2006
    25,813 Posts
    You can use PHP to echo the desired code when necessary in your login.php, kind of like this:

    Code:
    /*HTML header shit goes here*/
    <?php
    echo ('<input type="submit" value="Submit">');
    ?>
    I'm not quite sure if that's the best way to go about it since I'm fairly new to the web programming thing but it's worked for me

  3. Post #3
    sseug's Avatar
    June 2010
    174 Posts
    I have no idea what you're talking about but it sounds and looks like you need to learn HTML and PHP some more.
    Reply With Quote Edit / Delete Reply United States Show Events Dumb Dumb x 1Agree Agree x 1 (list)

  4. Post #4
    turb_'s Avatar
    February 2010
    2,202 Posts
    You can use PHP to echo the desired code when necessary in your login.php, kind of like this:

    Code:
    /*HTML header shit goes here*/
    <?php
    echo ('<input type="submit" value="Submit">');
    ?>
    I'm not quite sure if that's the best way to go about it since I'm fairly new to the web programming thing but it's worked for me
    What the fuck

  5. Post #5
    kill yourself
    Protocol7's Avatar
    June 2006
    25,813 Posts
    What the fuck
    1. You write HTML you want displayed
    2. Echo it with PHP once they submit the form

  6. Post #6
    turb_'s Avatar
    February 2010
    2,202 Posts
    Why are you using echo to output HTML?

  7. Post #7
    Gold Member
    h2ooooooo's Avatar
    June 2007
    977 Posts
    Why do you use parenthesis in echo? Why haven't you ended your input tag?

    Oh.. and what turb_ said

  8. Post #8
    Gold Member
    deadeye536's Avatar
    February 2008
    1,526 Posts
    It looks like the only place where php comes into play is after you submit the form. Just keep the form action/method the same, and you should be just fine (even though all that form does is act as a link to login.php).

  9. Post #9
    kill yourself
    Protocol7's Avatar
    June 2006
    25,813 Posts
    I never said I was good at PHP so christ give me a fucking break and actually try helping the OP instead of correcting my own mistakes

  10. Post #10
    Zayfox's Avatar
    August 2008
    1,246 Posts
    I never said I was good at PHP so christ give me a fucking break and actually try helping the OP instead of correcting my own mistakes
    "I never said I was good at architecture so Christ give me a fucking break and try to help the guys that need a house instead of giving me shit 'cause the one I designed fell down."

  11. Post #11
    kill yourself
    Protocol7's Avatar
    June 2006
    25,813 Posts
    "I never said I was good at architecture so Christ give me a fucking break and try to help the guys that need a house instead of giving me shit 'cause the one I designed fell down."
    that's completely different you fucking idiot

    if you have any common sense you'd know not to build a house if you know you can't

    something more insignificant like PHP is different because even if I do fucking suck at least I can have the gratitude of being one of the THE VERY FEW PEOPLE IN THIS FORUM WITH THE COURAGE TO HELP THE OP even already knowing my PHP sucks.

    So grow up, quit chastising me because you spend more time coding than I do and just help the OP.

    I DO appreciate you guys trying to make the effort to better my PHP, but that's really not what's important here

  12. Post #12
    turb_'s Avatar
    February 2010
    2,202 Posts
    Shutup Protocol7, you shouldn't be trying to help if you have no fucking idea what you're on about.
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Agree Agree x 1 (list)

  13. Post #13
    sseug's Avatar
    June 2010
    174 Posts
    that's completely different you fucking idiot

    if you have any common sense you'd know not to build a house if you know you can't

    something more insignificant like PHP is different because even if I do fucking suck at least I can have the gratitude of being one of the THE VERY FEW PEOPLE IN THIS FORUM WITH THE COURAGE TO HELP THE OP even already knowing my PHP sucks.

    So grow up, quit chastising me because you spend more time coding than I do and just help the OP.

    I DO appreciate you guys trying to make the effort to better my PHP, but that's really not what's important here
    Yo yo simmer down.
    First of all, the mistake you made was one of simple logic - why would you echo an input with PHP instead of just putting it in as HTML? What does that solve?

    Second, jesus, stop making such a big deal out of this shit.

  14. Post #14
    kill yourself
    Protocol7's Avatar
    June 2006
    25,813 Posts
    Shutup Protocol7, you shouldn't be trying to help if you have no fucking idea what you're on about.
    so then you help the OP you asshole

  15. Post #15
    EGN Founder
    CountNoobula's Avatar
    May 2010
    505 Posts
    I am still not fully aware of what you are wanting... However I have the rough idea that you want to click login then get redirected to a page with alot of forms, etc... So use JavaScript, although now your actual login? I don't see any data to really submit(reason why I chose javascript, although PHP would work just as effectively)

    PHP Code to Redirect:
    Code:
    <?php header("Location: http://www.mysite.com/pagetogoto.html"); ?>
    JavaScript Code to Redirect:
    Code:
    <script language="javascript">
    function login() {
        window.location = "http://www.mysite.com/"
    }
    </script>
    For the submit button for the JavaScript Method:
    Code:
    <input type="submit" onClick="login()" value="LOGIN"
    PS: If you go the JavaScript Method, may I recommend you remove the form or give the action attribute a "#" value.

    PPS: For a basic login system, you would need to create a form like this:
    Code:
    <form action="login.php" method="POST"><input type="text" size="20" name="user" /><br /><input type="password" size="20" name="pass" /><br /><input type="submit" value="Submit" /></form>
    Then for the "login.php" file, you would use code similiar to this:
    Code:
    <?php 
    
    //Starts Session
    session_start; 
    
    //Connects to Host
    $link = mysql_connect("hostname", "username", "password");
    
    if($link) {
    
    //Selects Database
    $select = mysql_select_db("databasename");
    if($select) {
    
    //Removes Special Characters from submitted data
    $user = mysql_real_escape($_POST['user']);
    $pass = mysql_real_escape($_POST['pass']);
    
    //Locates User
    $query = mysql_query("SELECT * FROM tablename WHERE user = '".$user."' AND password = '".md5($pass)."'");
    
    $result = mysql_num_rows($query);
    
    if($result == 1) {
    //Gathers User Data from file
    $row = mysql_fetch_array($query);
    
    //Sets variable to check whether user is logged in on other pages
    //Just use a simple if($_SESSION['active'] ==  true) {perform actions}
    //REMEMBER TO START YOUR SESSION
    $_SESSION['active'] = true;
    
    //Uncomment one of the following to script lines
    
    //Redirects the user to a general page
    //header("Location: http://mysite.com/pagetogoto.html");
    
    //Redirects the user to a per user page
    //header("Location: http://mysite.com/pagetogoto.php?id=".$row[id]);
    
    } else {
    echo "No user found.";
    }
    } else {
    echo "Could not select database";
    }
    } else {
    echo "Could not connect to host";
    }
    ?>
    Take note that script is very rough and would ofc need to be customised abit, hope it helps you abit though...

    PPPS: Apologies for any errors that it might contain... I was pressed for time, I can update it to be more accurate later if you so wish
    Reply With Quote Edit / Delete Reply South Africa Show Events Agree Agree x 1 (list)

  16. Post #16
    wutanggrenad's Avatar
    September 2007
    1,197 Posts
    About the bickering that has occurred in this thread above me.

    I suggest for those that are beginning in any language to watch and wait for other more experienced programmers/designers to first post, usually their methods are better and make more sense.

    If no one does post, than feel free to post what your opinion/code.

    Anyone that has years of experience in any language knows that they have gotten better over time, and thought "man, I should've done it this way years ago"
    Reply With Quote Edit / Delete Reply Canada Show Events Agree Agree x 1 (list)

  17. Post #17
    Gold Member
    deadeye536's Avatar
    February 2008
    1,526 Posts
    About the bickering that has occurred in this thread above me.

    I suggest for those that are beginning in any language to watch and wait for other more experienced programmers/designers to first post, usually their methods are better and make more sense.

    If no one does post, than feel free to post what your opinion/code.

    Anyone that has years of experience in any language knows that they have gotten better over time, and thought "man, I should've done it this way years ago"
    That's how I usually play the game in Web Development. I know I may be better than some, but I know there are several more commoners that are far more superior than I. I've been lurking here, learning the ways of the masters

  18. Post #18
    Gold Member
    andersonmat's Avatar
    May 2008
    2,607 Posts
    :mmmsmug: