manage page with php
I am new to PHP.
I am building my own forum by php.
I have a little problem that I want to manage pages or posts for it. That means when an user wants to write a new post in different subjects but I want to link to 1 file for example post.php, I dont know how to differentiate them.
I have read some guides that follow post.php is somethings like post.php?action=.... . But I still dont understand the things after .php?..
Can someone tell me about this? because idk it is just 1 file post.php but different action or they are different.
Can someone tell me details about what follow that or give me a link that I can read. This maybe simple but actually I dont understand.
Thank you so much.
It is one page with different actions, or get requests.
Basically anything after ? is the variable name, anything after the = is what thait variable contains if you want two variables use &.
and to call those
This should output:
$a = $_GET['a'];
$b = $_GET['b'];
echo "a= $a <br /> b = $b";
unless I typed something wrong you also may want to use isset (http://php.net/manual/en/function.isset.php) so you aren't calling variables that have been set/used.
Also, in the bigger picture, then all you need to do is add "if" statements checking the information in the previous post, and do the action that matches what was sent.
One way to use a single form to do multiple actions (aside from checking exactly what data was sent, which is also possible) is to use two different submit buttons named the same thing:
<input type="submit" name="mysubmit" value="next">
<input type="submit" name="mysubmit" value="previous">
Then check $_POST['mysubmit'] to see if it was "next" or "previous" (or anything else you want) and decide what to do.
Note that post and get work the same way: $_GET/$_POST, <form method="get"> OR <form method="post">. If you use "get", then the info will appear in the URL and you can also just use regular links for this. If you use "post" it will be hidden (sent separately from the URL) and is more common with things that are only for forms because you can't use it by just typing a new URL.
In general, your question is very broad, so once you know a little more about your plans please post back with some code or more details about the specific parts that are confusing and we'll try to help. But at the moment I think you'd do well just reading some introductory tutorials for PHP because most of this is part of what PHP is very often used for.
Thanks alot for giving help, now I understood .
I am reading a book and try to practice it on my website.
I will read and search carefully before posting questions. Just now this problem I didn't know how to search, tried some but no results.
Thank you for usefull information.