Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialYaxin Yuan
11,191 PointsThe order of php code
I am kinda surprised that it worked when you put
if ... $_SERVER["REQUEST_METHOD"] == "POST"
in the very beginning of the file. Since
<form method = "POST">
comes after. I thought it implied that order does not matter for php. But then you put
if ... $_GET["status"]
right after
<h1>
tag.....if order does not matter, this can be put anywhere in the file.....
So does order matter or not? Thanks!
1 Answer
shezazr
8,275 Pointsthe two statements are not doing the same thing.. one is checking if your user has submitted a form (Post request), the other is checking if your URL has that param.. so in this case order does not matter.. but generally order DOES matter.. try doing a SQL query from database and then afterwards get the form data which you really need to do the SQL query... it all depends on your application/website