开发者

How to - Go Dynamic with PHP [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 10 years ago.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜