Putting HTML in PHP
Moderator: General Moderators
- Heavy
- Forum Contributor
- Posts: 478
- Joined: Sun Sep 22, 2002 7:36 am
- Location: Viksjöfors, Hälsingland, Sweden
- Contact:
Now, don't get me the angry way if I hurt your pride, the following is just me trying to help you out.
When I see this:
I also wonder if you wrote that yourself. It is OK if you did not, but I mean, If you don't know what echo is, the above is an awful lot of php code.
When I see this:
http://www.php.net/manual/en/langref.php
but especially:
http://www.php.net/manual/en/langref.php
and
http://www.php.net/manual/en/language.types.string.php
Don't just skim through the chapters. Read them carefully, it is not very much, but I guess those links will get you on track.
If I have made a mistake probing for your present skills. FLAAAAME ME.
Just know that I just want to help.
Peace
When I see this:
... I wonder whether you know about matching braces.Mexican Hat wrote:Still confused.
But I know that not right. Where do I put this code:Code: Select all
<?php function valid_login($username, $password) { return ($username == 'name1' && $password == 'pass1') or ($username == 'name2' && $password == 'pass2') or ($username == 'name3' && $password == 'pass3'); } function login_screen($failed = 0) { ?><html> <head><LINK REL=StyleSheet HREF="_style.css" TYPE="text/css"></HEAD> <body bgcolor="#e1e1e1"><center> <form action="<?php echo $_SERVERї'PHP_SELF']; ?>" method='post'> <table border="0"> <TR><TD>Username:<TD><input type="text" name="username" maxlength="20"> <TR><TD>Password: <TD><input type="password" name="password" maxlength="20"> <TR><TD colspan="2"><center><input type="submit" name="submit" value="Login"> </table> </form> <BR><BR> if ($failed) $output .= <font color = red><b>Failed ".$_SESSIONї'count']." time(s) : Keep Trying Biatch</b></font> return $output ."<BR><BR></center></body></html>"; } session_start(); if( ! isset($_SESSIONї'count']) ) $_SESSIONї'count'] = 0; else $_SESSIONї'count']++; if( ! isset($_SESSIONї'logged_in']) ) { if ( ! isset($_POSTї'submit'])) { die (login_screen()); } elseif ( valid_login($_POSTї'username'], $_POSTї'password']) ) { $_SESSIONї'count'] = 1; $_SESSIONї'logged_in'] = 1; } elseif ( $_SESSIONї'count'] > 3 ) { header("Location: baby/index.html"); exit; } else { die ( login_screen($failed = 1) ); } }
PeaceCode: Select all
} session_start(); if( ! isset($_SESSIONї'count']) ) $_SESSIONї'count'] = 0; else $_SESSIONї'count']++; if( ! isset($_SESSIONї'logged_in']) ) { if ( ! isset($_POSTї'submit'])) { die (login_screen()); } elseif ( valid_login($_POSTї'username'], $_POSTї'password']) ) { $_SESSIONї'count'] = 1; $_SESSIONї'logged_in'] = 1; } elseif ( $_SESSIONї'count'] > 3 ) { header("Location: baby/index.html"); exit; } else { die ( login_screen($failed = 1) ); } }ї/
I also wonder if you wrote that yourself. It is OK if you did not, but I mean, If you don't know what echo is, the above is an awful lot of php code.
When I see this:
it seems to me like you need to read about these things:Mexican Hat wrote:I'm trying to get the hang of php but it's still confusing. The thing I don't understand is why you can't just put your regular HTML in php you have to change it around with / or '.
Peace
http://www.php.net/manual/en/langref.php
but especially:
http://www.php.net/manual/en/langref.php
and
http://www.php.net/manual/en/language.types.string.php
Don't just skim through the chapters. Read them carefully, it is not very much, but I guess those links will get you on track.
If I have made a mistake probing for your present skills. FLAAAAME ME.
Just know that I just want to help.
Peace
Last edited by Heavy on Fri Jun 27, 2003 1:16 pm, edited 1 time in total.
heavey: echo, print and things like that don't appear in markup languages... i know a number of people that pick up markup languages and think they can do it all... as sooon as they get off markup languages they freeze.. they realize it's nothing like what they thought...i get the feeling that he learned markup languages and is now trying to learn a scripting lang. we should also tell him about xemacs. http://www.xemacs.org
it's the best programming editor out there if you wantmy opinion
it's the best programming editor out there if you wantmy opinion
- Heavy
- Forum Contributor
- Posts: 478
- Joined: Sun Sep 22, 2002 7:36 am
- Location: Viksjöfors, Hälsingland, Sweden
- Contact:
Yeah.m3rajk wrote:heavey: echo, print and things like that don't appear in markup languages...
I saw this:
Code: Select all
<?php
session_start();
if( ! isset($_SESSION['count']) ) $_SESSION['count'] = 0;
else $_SESSION['count']++;
?>I use Zend Studio Personal Edition. What can I say... It's slow. But it is the only editor I have come across that really suits my needs, and has syntax hiliting beyond others, code completion with class digging and other cool things.
(Don't like emacs myself.)
EDIT: I made a post about editors here.
- Mexican Hat
- Forum Newbie
- Posts: 19
- Joined: Sat Mar 08, 2003 8:35 pm
- Location: Baltimore, Maryland
- Contact:
Hey Heavy,
Yeah that code I got off of someone here on this forum. I didn't make it myself. I started trying to learn php just a month ago but haven't gotten very far. So I really don't know much about it. I think I'm try to skip ahead more than I can handle.
I'll try to read up on some stuff from the links you provided.
I'll start working on the login thing once I read up on some php because I have no clue really what going on.
Oh do any of you people know of any good php books?
Peace
Yeah that code I got off of someone here on this forum. I didn't make it myself. I started trying to learn php just a month ago but haven't gotten very far. So I really don't know much about it. I think I'm try to skip ahead more than I can handle.
I'll try to read up on some stuff from the links you provided.
I'll start working on the login thing once I read up on some php because I have no clue really what going on.
Oh do any of you people know of any good php books?
Peace
yes
and i also know what was the cheapest place for me to get them even with sales tax... you're not going to have sales tax from this place...
Programming PHP
PHP Cookbook
and i also know what was the cheapest place for me to get them even with sales tax... you're not going to have sales tax from this place...
Programming PHP
PHP Cookbook
- Mexican Hat
- Forum Newbie
- Posts: 19
- Joined: Sat Mar 08, 2003 8:35 pm
- Location: Baltimore, Maryland
- Contact:
Thanks
YeaH I think I might go with "Programming PHP". I've heard some good things about it.
Peace
Peace
i have both. programmping php is a great tutorial if you're got familiarty with languages and like all oreilly books, a great reference after you are comfortable with the language.
the cookbook has sample code solutions to specific common problems. basic things that they expect people to deal with often and be able to modify for their specific needs.
the cookbook has sample code solutions to specific common problems. basic things that they expect people to deal with often and be able to modify for their specific needs.
