Thursday, February 7, 2013

PHPcoding (NOOB edition)

tonight.. i just playing with PHPcoding.

Start with login page but first i will create new folder in my server.

[dora@localhost public_html]$ mkdir project2
[dora@localhost public_html]$ ls
project1  project2  rnd  smf  test

[dora@localhost public_html]$ cd project2
[dora@localhost project2]$ nano -w index.php



done. then i do the "processing" [dora@localhost project2]$ nano -w login.php

[?php $username = $_REQUEST['username']; $password = $_REQUEST['password']; if ($username === 'Darlinx' && $password === 'Darlinx') echo "Password correct"; else echo "Password incorrect";

Form eXplaination :: [?php = is a tag to php form. in this process the form will received input. it will retrieve from global << [input name="username" $username $password = example of variable. echo = is for output. print as 'text' ** when u submit the first form (login) the data will be transfer to login.php now we need a comparison. I will set the input for "username" & "password" here. :)
ok. now i want to create "table" in my form. let say i hav $x number of rows & $y number of columns create new php file. [dora@localhost project2]$ nano -w table.php form eXplaination : ** this is what we call nested loop LOOP ROWS WHILE ROWS IS LESS THAN 3 PRINT ROW OPENING LOOP COLUMNS WHILE ROWS IS LESS THAN 4 PRINT COLUMN WITH ROW NUMBER AND COLUMN NUMBER LOOP END PRINT ROW CLOSING LOOP END
try to add border since. :X but.. that's how the loop working. i understand now. :)

No comments:

Post a Comment