looking for study partner/s to learn PHP!



Im keeping an eye on this thread. I want to learn php and have tons of books and vids but i cant learn by just reading syntax. I need practice and i don't know where to get it.
 
Thanks for the suppourt. I will see this through even if it is just me adding my notes on how i'm doing and a few examples etc... The book is going to be headfirst PHP and MySQL so if you want to join in properly you will need a copy (dont worry about getting an out of date version there is only one edition so far). I will look to start sometime before next weekend or maybe the beginning of next week if people need time to get the book. Speak soon!
 
Just from working with wordpress and messing around with widgets, plugins, etc I'm getting a good basic understanding of PHP. I'd be down to team up with you guys.
Welcome aboard! Wordpress is one of the things i wanted to look at so it would be good to have you.
 
**BOOK** if anybody reading this is put off because you have to buy a book. It is available as a pdf if you do some digging. But really you should suppourt future publications and buy the book!!
;)
 
Thanks for mentioning this thread on msn, Ill keep a look on it. :) Although i have to second the above opinions that problem based learning is (probably) more effective than just following a book. OP or someone else could post a problem and then everyone could solve it their own way over the week and discuss hickups here. That way we will see differnt methods and see which are more efficient and so on.
 
Larry Ullman's books are good. He wrote some of the Visual Quickstart series.

PHP: Hypertext Preprocessor
PHP Web Application Server - PHP Developer tools - PHP Training & Certification - Zend.com
Google

Good resources as well. I probably use Google the most because I constantly forget formating.

For example: I was trying to use the date function and kept getting parse errors. I was using it this way:
Code:
<?php date(M j, Y); ?>
And what I wanted it to do was print today's date on the screen. Kept getting errors. Straight to google and punch in "php date". Forgot "echo" (to print it to the screen) and quotes. It ends up that this is what it should have been:
Code:
<?php echo date("M j, Y"); ?>
Not too far off, but it only takes one character to screw things up.

aмillionaírе;852330 said:
Perhaps you all should be given assignments? :rasta:

First Assignment:

Create a form that allows someone to enter their name, and then have PHP check to see if the name variable is null or not. If it is empty, then tell them to enter their name, if it is not empty, print "Hello {name}" on the screen.

There you go. Have fun.
 
Calamity. The book is very 'hands on' with lots of prctical work and i have a few ideas to get people doing stuff.
 
First Assignment:

Create a form that allows someone to enter their name, and then have PHP check to see if the name variable is null or not. If it is empty, then tell them to enter their name, if it is not empty, print "Hello {name}" on the screen.

There you go. Have fun.

Hehe this took me probably over one hour of trial and error. Still couldnt figure out how to keep everything in one file. Another problem is if they dont write a name they have to press back to write it. Would have been handier if it could check before sending them on. Oh well will try more tomorrow.
html file
Code:
<html>
<body>

<form action="hello.php" method="post">
Name: <input type="text" name="name" />
<input type="submit" />
</form>

</body>
</html>
php file
Code:
<html>
<body>

<?php
if (!empty($_POST[name]))
  echo "Hello " , $_POST["name"];  
else echo "Please write your name.";
?>

</body>
</html>
 
Hehe this took me probably over one hour of trial and error. Still couldnt figure out how to keep everything in one file. Another problem is if they dont write a name they have to press back to write it. Would have been handier if it could check before sending them on. Oh well will try more tomorrow.
html file
Code:
<html>
<body>

<form action="hello.php" method="post">
Name: <input type="text" name="name" />
<input type="submit" />
</form>

</body>
</html>
php file
Code:
<html>
<body>

<?php
if (!empty($_POST[name]))
  echo "Hello " , $_POST["name"];  
else echo "Please write your name.";
?>

</body>
</html>[/QUOTE]

Someone did their homework. So, someone deserves help.

"Still couldnt figure out how to keep everything in one file"

You echo the html and escape all of the quotes inside of it. You add a hidden field type with something in it then you have the script check if that field is set. In order for this to be done the script must submit to itself (php global variable $_SERVER['PHP_SELF']). 

check if field is set -> [url=http://php.net/manual/en/function.isset.php]PHP: isset - Manual[/url]
escape html code -> [url=http://php.net/manual/en/function.htmlentities.php]PHP: htmlentities - Manual[/url]

code example


[QUOTE]<?php

if(!isset($_POST['form_posted'])) {
$self=$_SERVER['PHP_SELF'];
echo "<form name=/"wickedfire/" method=/"post/" action=/"$self/">
<input type=/"text/" name=/"name/"><br>
<input type=/"hidden/" name=/"form_posted/"><br>";

} else {

$name=$_POST['name'];

echo "How much money you make today, $name?";
echo "Cool, that's enough to buy some beer";

}

?>[/QUOTE]
 
Line 1: exclamation mark changes rules from if $_POST['form_posted'] posted to IF $_POST['form_posted'] NOT posted.

Line 2: Why put a variable in a variable? If we $_SERVER['PHP_SELF'] directly it will not be parsed within quotes, because of these characters: []. So we make a non-array variable (without []).

Line 3: Why did we put / before the quotes? Because we chose quotes to parse the echo, meaning the script needs to know what to parse and what to not parse (where to start and where to end). the / symbol is escape and means to ignore syntax. BTW: a double // means comment, to ignore anything that follows.

:rasta:
 
P.S. - to automatically redirect the user back to the form if they f*ck up, use an exit function that echos a header function in an isset conditional.

:rasta:
 
Good work calamity. PM me i set you up some web space. MySQL databases are limited. First come first served. Time to get on with this first task then!!
 
Stuck!

Can anybody help me spot the error?
Browser says: Parse error: syntax error, unexpected T_STRING, expecting ',' or '; .... LINE 5
Code:
<html>
<body>
<?php
if(!isset($_POST['name'])){
  echo "<form action=/"ex1.php/" method=/"post/">
  Please enter your name <input type=/"text/" name=/"name/"/>
  <br/>
  <input type=/"submit/" value=/"Submit/"/>
  </form>";
}else{
  echo "Hello <?php echo $_POST["name"]; ?>, i can make PHP powered forms!";
}
?>
</body>
</html>
Thanks.
 
greyhat: I'm the one who made the huge error in this thread.

The escape character is not /, but it is \ (the back slash). Double backslash = comment.

Drunk on Mother's Day.



:rasta: