ahmed_elfeky Posted June 10, 2013 Share Posted June 10, 2013 Hey guys, i am a new member here and i was wondering if you could help me with this code i cant figure out how to show an error message in the same page if one of the fields is empty i can make it appear in another page but i dont know how to make it in the same page the following code is the code i've reached till now: <html> <head> <title>Add Hotel</title> <?php include("Includes/staffHeader.php"); ?> <table width="400" border="0" align="center" bgcolor="#d1cfcf"> <tr> <td> <form action="createCity.php" method="post" class="addhotel" > <ul> <li> <br /> <label for="cityName">Name Of City: </label> <input name="city_Name" type="text" value=""> </li> <li> <label for="History">History:</label> <textarea name="History" cols="25"></textarea> </li> <li> <br /> <label for="location">location: </label> <input name="location" type="text" value=""> </li> <li> <label for="whereToGo">Where To Go?</label> <textarea name="where_To_Go" cols="25" rows="5" > </textarea> </li> <li> <br /> <label for="climate">Climate: </label> <input name="climate" type="text" value=""> </li> <li> <br /> <label for="name_meaning">Name & meaning: </label> <input name="name_meaning" type="text" value=""> </li> <li> <form action="upload.php" method="post" enctype="multipart/form-data"> <label for="add video">Add video:</label> <input type="file" name="uploaded2" /> <input type="submit" value="Upload" /> <li> <input type="submit" value="Save" /> </li> </form> </td> </tr> </table> </body> </html> please need your help ASAP, i am on a deadline for my graduation project thanx in advance Quote Link to comment https://forums.phpfreaks.com/topic/279010-questionshowing-the-error-msg-in-same-page/ Share on other sites More sharing options...
Solution requinix Posted June 10, 2013 Solution Share Posted June 10, 2013 (edited) PHPFreaks.com Questions, Comments, & Suggestions This is NOT a help forum! Do not post topics asking for help that are not related to the website. You say you "can't figure out how" so that must mean you don't know how to proceed. Typically you either a] Make the form post back to the same page and find a way to move the logic from the other page into it. - Could move the logic into functions and call those functions - include() might even work b] Make the target page do the error checking and show this page if there's a problem. - Could redirect if you can find a way to pass along what values were entered what what the error messages are. Maybe sessions - include() might even work Edited June 10, 2013 by requinix Quote Link to comment https://forums.phpfreaks.com/topic/279010-questionshowing-the-error-msg-in-same-page/#findComment-1435211 Share on other sites More sharing options...
ahmed_elfeky Posted June 10, 2013 Author Share Posted June 10, 2013 Sorry about posting in the wrong forum , like I said earlier I'm a new member. and Thanks for your help I'll try that solution Quote Link to comment https://forums.phpfreaks.com/topic/279010-questionshowing-the-error-msg-in-same-page/#findComment-1435220 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.