How to avoid aa empty values in a text box

Reply

Join Date: Mar 2009
Posts: 28
Reputation: nathenastle is an unknown quantity at this point 
Solved Threads: 2
nathenastle's Avatar
nathenastle nathenastle is offline Offline
Light Poster

How to avoid aa empty values in a text box

 
0
  #1
Apr 18th, 2009
Hi this is nathen can you please some one help me the following is my form what i want is when ever i fill an empty value that is nothis in my text box and when click on shareacoupon button i need a message that empty values are not allowed this is urgent.Thanks in advance ....
  1. <?php
  2. ob_start();
  3.  
  4. extract($_REQUEST);
  5. include("includes/connection.php");
  6. if(isset($_POST["submit"]))
  7. {
  8. $sql_insert="INSERT INTO `fair`.`couponshare` (`storename` ,`code` ,`offer` ,`expiration Date`)
  9. VALUES ('$store_name', '$store_code', '$deal_discount', '$edate')";
  10. $res=mysql_query($sql_insert);
  11. }
  12. ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  13. <html xmlns="http://www.w3.org/1999/xhtml">
  14. <head>
  15. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  16. <title>Untitled Document</title>
  17. <link rel="stylesheet" type="text/css" href="images/style.css">
  18. <link rel="stylesheet" type="text/css" href="chrometheme/chromestyle.css" />
  19. <script type="text/javascript" language="javascript" src="includes/validation.js"></script>
  20.  
  21. <script language="JavaScript" type="text/javascript" src="images/ddmenu.js"></script>
  22. <link rel="stylesheet" type="text/css" media="all" href="calendar-win2k-cold-1.css" title="win2k-cold-1" />
  23. <script type="text/javascript" src="lang/calendar.js"></script>
  24. <script type="text/javascript" src="lang/calendar-en.js"></script>
  25. <script type="text/javascript" src="lang/calendar-setup.js"></script>
  26. <script type="text/javascript">
  27. Calendar.setup({
  28. inputField : "f_date_k", // id of the input field
  29. ifFormat : "%m/%d/%Y", // format of the input field
  30. button : "f_trigger_k", // trigger for the calendar (button ID)
  31. align : "Tl", // alignment (defaults to "Bl")
  32. singleClick : true
  33. })
  34. Calendar.setup({
  35. inputField : "f_date_g", // id of the input field
  36. ifFormat : "%m/%d/%Y", // format of the input field
  37. button : "f_trigger_g", // trigger for the calendar (button ID)
  38. align : "Tl", // alignment (defaults to "Bl")
  39. singleClick : true
  40. })
  41. </script>
  42. </head>
  43. </head>
  44.  
  45. <body>
  46. <form name="myform" method="post" action="">
  47. <table width="200" border="1">
  48.  
  49. <tr>
  50. <td colspan="2" align="center"><strong><font size="+1" color="#6699FF">Share A Coupon</font></strong></td>
  51. </tr>
  52. <tr>
  53. <td>Store Name:</td><td><input type="text" name="store_name" id="store_name" /></td>
  54. </tr>
  55. <tr>
  56. <td>Code:</td><td><input type="text" name="store_code" id="store_code" /></td>
  57. </tr>
  58. <tr>
  59. <td>Offer:</td><td><input type="text" name="deal_discount" id="deal_discount" /></td>
  60. </tr>
  61. <tr>
  62. <td colspan="2"><span class="normal">
  63. Expiration Date:
  64. <input type="text" name="edate" class="normal" style="width:80px;" id="f_date_g">
  65. &nbsp;<img src="images/calendar.gif" id="f_trigger_g" style="cursor: pointer; "
  66. onmouseover="this.style.background='red';" onmouseout="this.style.background=''" border="0" /></span></td>
  67. </tr>
  68. <tr>
  69. <td><input type="submit" name="submit" id="submit" value="Submit coupon"/></td><td align="center"><input type="submit" name="close" id="close" value="close"/></td>
  70. </tr>
  71. </table>
  72. </form>
  73. </body>
  74. </html>
Last edited by Ezzaral; Apr 18th, 2009 at 11:39 am. Reason: Added [code] [/code] tags. Learn to use them.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 232
Reputation: samarudge is an unknown quantity at this point 
Solved Threads: 19
samarudge samarudge is offline Offline
Posting Whiz in Training

Re: How to avoid aa empty values in a text box

 
0
  #2
Apr 18th, 2009
My Blog, Life and everything that matters to me - SamRudge.co.uk

2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC