But I don't get the best solution for my need.
My Problem is:
I create a form with TextBox Name, TextBox Message, Submit button, and it use POST method. I want form'process done in the same page.
After the user input data to TextBox Name and TextBox Message and pressed submit button,it send data well.
If the user input data to TextBox Message with word' length more than 100 words, it will display warning.
But if the user click refresh or F5 or Back button, in Firefox,it will display resend confirmation. So, I add line:
header("location: thispage.php");
to prevent the browser show resend confirmation.
But, as the result,
if the user input data to TextBox Message with word' length more than 100 words, it will not display warning.
Could you help me to solve my problem for it can show warning again with your script..Thank you for your kind attention..
Best regards,
Fritz Gamaliel
Here is my code:
Expand|Select|Wrap|Line Numbers
- <?
- if(isset($_POST['BtnShout']))
- {
- //SEND COMMENT AND SHOW IT TO SCREEN PROCESS
- //STEP1.GET DATA
- $vName=$_POST["TxtName"];
- $vMessage=$_POST["TxtMessage"];
- //STPE2.COMMENT MUST < 100 WORDS
- if(strlen($vMessage)>100)
- {
- $warning = "Comment must < 100 words.";
- }
- header("location: thispagename.php");
- }
- ?>
- <HTML>
- <TITLE> MyWEB </TITLE>
- <head></head>
- <body>
- <form action="" method="post">
- Name:
- <input type="text" name="TxtName" maxlength=6 size=20/><br>
- Message
- <textarea name="TxtMessage" cols="50" ></textarea><br>
- <input type="submit" name="BtnShout" value="shout!"/>
- </form>
- <?
- echo $warning."<BR>";
- ?>
- </BODY>
- </HTML>