How to - Go Dynamic with PHP [closed]
I have a form which actions against a php file. Once the form is completed and the data is inserted into the databse, it want it to display "Awesome". Awesome is being displayed bu开发者_Go百科t is above the form. I want it to replace the form and display awesome. How do i do that?
Thank You.
if($done )
{
echo "Awesome";
}
else
{
echo "Error";
}
You can make wonders with the if/else
control structure.
Presumably you have something along the lines of:
if (condition) {
Awesome
}
The Form
Change it to
if (condition) {
Awesome
} else {
The Form
}
If you are overwhelmed with structuring your code in a way that gives the desired result, then you should take advantage of PHPs include()
capability. Put your form in a second file, then rewrite your result logic:
if($done )
{
echo "Awesome";
include("form.php");
}
else
{
echo "Error";
}
Or wherever you want the form to appear.
精彩评论