Jump to content

[Question]Showing the Error Msg in same page


ahmed_elfeky
Go to solution Solved by requinix,

Recommended Posts

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

Link to comment
Share on other sites

  • Solution

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 by requinix
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.