473,563 Members | 2,916 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

automatic save

underscore
30 New Member
gud day to all TSD.


if i run the code below which is HTML combine with php. my problem encoutered in php code. it will automatically save all blank textbox i declare in php to my database using mysql if i will run this page.

please correct my problem in my code.

thnx again...

Expand|Select|Wrap|Line Numbers
  1.  
  2. <? session_start(); ?>
  3.  
  4. <head>
  5. <title>My Page</title>
  6. <style type="text/css">
  7. <!--
  8. #Layer1 {
  9. position:absolute;
  10. left:200px;
  11. top:10px;
  12. width:816px;
  13. height:540px;
  14. z-index:1;
  15. }
  16. .style3 {font-family: Arial, Helvetica, sans-serif}
  17. .style4 {font-family: Arial}
  18. a:link {
  19. text-decoration: none;
  20. }
  21. a:visited {
  22. text-decoration: none;
  23. }
  24. a:hover {
  25. text-decoration: none;
  26. }
  27. a:active {
  28. text-decoration: none;
  29. }
  30. .style14 {color: #FF0000; font-family: Geneva, Arial, Helvetica, sans-serif; }
  31. -->
  32. </style>
  33. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  34. </head>
  35.  
  36. <body>
  37.  
  38. <div id="Layer1">
  39. <table width="808" height="538" border="0" cellpadding="0" cellspacing="0" bordercolor="#2A1F00">
  40. <tr>
  41. <td width="236" height="110"><img src="image/Nagano Header.jpg" width="236" height="110" alt="" /></td>
  42. <td colspan="4"><img src="image/header.jpg" width="598" height="110" alt="" /></td>
  43. </tr>
  44. <tr>
  45. <td height="22" colspan="5" bordercolor="#0000FF" bgcolor="#DAE2C7"><span class="style14">CREATE YOUR ID</span> </td>
  46. </tr>
  47.  
  48. <form name="form1" method="post" action="register.php">
  49.  
  50. <tr>
  51. <td height="42" bgcolor="#F7F7F7"><div align="right" class="style3">* First Name </div></td>
  52. <td width="20" bgcolor="#F7F7F7">&nbsp;</td>
  53. <td width="159" bgcolor="#F7F7F7"><input name="txtfname" type="text" id="txtfname" /></td>
  54. <td width="48" bgcolor="#F7F7F7">&nbsp;</td>
  55. <td width="364" bgcolor="#F7F7F7"><label></label></td>
  56. </tr>
  57. <tr>
  58. <td height="25" bordercolor="#F7F3EF" bgcolor="#F7F7F7"><div align="right">* <span class="style4">Last Name</span> </div></td>
  59. <td bordercolor="#F7F3EF" bgcolor="#F7F7F7">&nbsp;</td>
  60. <td bordercolor="#F7F3EF" bgcolor="#F7F7F7"><input name="txtlname" type="text" id="txtlname" /></td>
  61. <td bordercolor="#F7F3EF" bgcolor="#F7F7F7">&nbsp;</td>
  62. <td bordercolor="#F7F3EF" bgcolor="#F7F7F7"><label></label></td>
  63. </tr>
  64. <tr>
  65. <td height="36" bordercolor="#F7F3EF" bgcolor="#F7f7f7"><div align="right" class="style4">* Gender </div></td>
  66. <td bordercolor="#F7F3EF" bgcolor="#F7F7F7">&nbsp;</td>
  67. <td bordercolor="#F7F3EF" bgcolor="#F7F7F7"><select name="mnugender" id="mnugender">
  68. <option value="0">[Select]</option>
  69. <option value="1">Male</option>
  70. <option value="2">Female</option>
  71. </select></td>
  72. <td bordercolor="#F7F3EF" bgcolor="#F7F7F7">&nbsp;</td>
  73. <td bordercolor="#F7F3EF" bgcolor="#F7F7F7"><label></label></td>
  74. </tr>
  75. <tr>
  76. <td height="34" bordercolor="#F7F3EF" bgcolor="#F7F7F7"><div align="right">* Log-in ID </div></td>
  77. <td bordercolor="#F7F3EF" bgcolor="#F7F7F7">&nbsp;</td>
  78. <td bordercolor="#F7F3EF" bgcolor="#F7F7F7"><label>
  79. <input name="txtlogid" type="text" id="txtlogid">
  80. </label></td>
  81. <td bordercolor="#F7F3EF" bgcolor="#F7F7F7">&nbsp;</td>
  82. <td bordercolor="#F7F3EF" bgcolor="#F7F7F7">&nbsp;</td>
  83. </tr>
  84. <tr>
  85. <td height="34" bordercolor="#F7F3EF" bgcolor="#F7F7F7"><div align="right" class="style4">* Password</div></td>
  86. <td bordercolor="#F7F3EF" bgcolor="#F7F7F7">&nbsp;</td>
  87. <td bordercolor="#F7F3EF" bgcolor="#F7F7F7"><input name="txtpassword" type="password" id="txtpassword" /></td>
  88. <td bordercolor="#F7F3EF" bgcolor="#F7F7F7">&nbsp;</td>
  89. <td bordercolor="#F7F3EF" bgcolor="#F7F7F7">&nbsp;</td>
  90. </tr>
  91.  
  92. <tr>
  93. <td bordercolor="#F7F3EF" bgcolor="#F7F7F7"><div align="right" class="style4">* Re-type Password </div></td>
  94. <td bordercolor="#F7F3EF" bgcolor="#F7F7F7">&nbsp;</td>
  95. <td bordercolor="#F7F3EF" bgcolor="#F7F7F7"><input name="txtretypepass" type="password" id="txtretypepass" /></td>
  96. <td bordercolor="#F7F3EF" bgcolor="#F7F7F7">&nbsp;</td>
  97. <td bordercolor="#F7F3EF" bgcolor="#F7F7F7"><label></label></td>
  98. </tr>
  99. <tr>
  100. <td height="38" bgcolor="#F7F7F7"><div align="right"><span class="style4">Birth Date </span></div></td>
  101. <td bgcolor="#F7F7F7">&nbsp;</td>
  102. <td bgcolor="#F7F7F7"><select name="mnuMonth" id="mnuMonth">
  103. <option value="0">[Select Month]</option>
  104. <option value="1">January</option>
  105. <option value="2">February</option>
  106. <option value="3">March</option>
  107. <option value="4">April</option>
  108. <option value="5">May</option>
  109. // OTHER OPTION VALUES 6-11 GOES HERE
  110. <option value="12">December</option>
  111. </select></td>
  112. <td bgcolor="#F7F7F7"><label>
  113. <select name="txtday" id="txtday">
  114. <option value="1" selected>1</option>
  115. <option value="2">2</option>
  116. <option value="3">3</option>
  117. // OTHER OPTION VALUES 3-30 GOES HERE
  118. <option value="31">31</option>
  119. </select>
  120. </label></td>
  121. <td bgcolor="#F7F7F7"><label>
  122. <input name="txtyear" type="text" id="txtyear" value="yyyy" size="4">
  123. </label></td>
  124. </tr>
  125. <tr>
  126. <td height="39" bgcolor="#F7F7F7"><div align="right" class="style4">Zip/Postal code </div></td>
  127. <td bgcolor="#F7F7F7">&nbsp;</td>
  128. <td bgcolor="#F7F7F7"><input name="txtzip" type="text" id="txtzip" /></td>
  129. <td bgcolor="#F7F7F7">&nbsp;</td>
  130. <td bgcolor="#F7F7F7">&nbsp;</td>
  131. </tr>
  132. <tr>
  133. <td height="27" bgcolor="#F7F7F7"><div align="right"><span class="style4">* Email Address</span></div></td>
  134. <td bgcolor="#F7F7F7">&nbsp;</td>
  135. <td bgcolor="#F7F7F7"><input name="txtemailadd" type="text" id="txtemailadd" /></td>
  136. <td bgcolor="#F7F7F7">&nbsp;</td>
  137. <td bgcolor="#F7F7F7">&nbsp;</td>
  138. </tr>
  139.  
  140. <tr>
  141. <td height="33" bgcolor="#F7F7F7"><div align="right" class="style4">User Access Level </div></td>
  142. <td bgcolor="#F7F7F7">&nbsp;</td>
  143. <td bgcolor="#F7F7F7"><label>
  144. <select name="mnuAccess" id="mnuAccess">
  145. <option value="0">[Select Level]</option>
  146. <option value="1">Administrator</option>
  147. <option value="2">Limited</option>
  148. </select>
  149. </label></td>
  150. <td bgcolor="#F7F7F7">&nbsp;</td>
  151. <td bgcolor="#F7F7F7">&nbsp;</td>
  152. </tr>
  153. <tr>
  154. <td height="19" bgcolor="#F7F7F7">&nbsp;</td>
  155. <td bgcolor="#F7F7F7">&nbsp;</td>
  156. <td bgcolor="#F7F7F7"><label></label></td>
  157. <td bgcolor="#F7F7F7">&nbsp;</td>
  158. <td bgcolor="#F7F7F7">&nbsp;</td>
  159. </tr>
  160. <tr>
  161. <td bgcolor="#F7F7F7"><a href="index.html" target="_parent"></a></td>
  162. <td bgcolor="#F7F7F7">&nbsp;</td>
  163. <td bgcolor="#F7F7F7"><input name="Submit" type="Submit" class="style4" id="Submit" value=" Submit " onClick="javascript:alert('Your form has been submitted')">
  164. <td bgcolor="#F7F7F7">&nbsp;</td>
  165. <td bgcolor="#F7F7F7">&nbsp;</td>
  166. </tr>
  167.  
  168. <tr>
  169. <td height="24" colspan="5" bgcolor="#F7F7F7"><div align="left">
  170. <blockquote>
  171. <blockquote>
  172. <blockquote>
  173. <blockquote>
  174. <blockquote>
  175. <blockquote>
  176. <p><a href="index.html" target="_parent"><strong>BACK TO HOME PAGE </strong></a></p>
  177. </blockquote>
  178. </blockquote>
  179. </blockquote>
  180. </blockquote>
  181. </blockquote>
  182. </blockquote>
  183. </div></td>
  184. </tr>
  185. <tr>
  186. <td bgcolor="#F7F7F7"><div align="right" class="style4"><a href="index.html" target="_parent"></a></div></td>
  187. <td bgcolor="#F7F7F7">&nbsp;</td>
  188. <td bgcolor="#F7F7F7"><a href="index.html" target="_parent"></a></td>
  189. <td bgcolor="#F7F7F7">&nbsp;</td>
  190. <td bgcolor="#F7F7F7"><label></label></td>
  191. </tr>
  192. </table>
  193.  
  194. </div>
  195. </body>
  196. </html>
  197.  
  198. <?php
  199.  
  200. if (isset($_POST["Submit"]))
  201.  
  202. include'package/connect.inc.php';
  203. mysql_select_db('database');
  204.  
  205. $user_sql = "INSERT INTO userpass(loginId,fname,lname,gender,password,repassword,bdate,zip,emailadd,accesslevel,regdate,reghours)
  206. values('". $_POST["txtlogid"] ."','". $_POST["txtfname"] ."','". $_POST["txtlname"] ."',
  207. '". $_POST["mnugender"] ."','". $_POST["txtpassword"] ."',
  208. '". $_POST["txtretypepass"]."','". $_POST["mnuMonth"]."-". $_POST["txtday"]."-". $_POST["txtyear"]."',
  209. '". $_POST["txtzip"]."',
  210. '". $_POST["txtemailadd"]."','". $_POST["mnuAccess"]."',
  211. '". date("F j, Y, g:i a")."','". date("H:i:s A")."')";
  212. $result = mysql_query($user_sql);
  213.  
  214. }
  215. ?>
  216.  
Sep 18 '07 #1
13 2646
ak1dnar
1,584 Recognized Expert Top Contributor
I had to remove some Html contents from the above code, because forum software doesn't support for that much of lines of code tags on a single attempt.
And I've added some comments on the removed sections and the
[code=php] tags too to the code listening. Thanks a lot.
Sep 18 '07 #2
underscore
30 New Member
I had to remove some Html contents from the above code, because forum software doesn't support for that much of lines of code tags on a single attempt.
And I've added some comments on the removed sections and the
[code=php] tags too to the code listening. Thanks a lot.

the result mr .jax still d same when i run this page it will automatically save a blank in my database.?

thnx
Sep 18 '07 #3
code green
1,726 Recognized Expert Top Contributor
the result mr .jax still d same when i run this page it will automatically save a blank in my database.?
NO! ajaxrand did not try to help you, he tried to help the rest of us by removing chunks of code not relevant to the problem.
There is still far too much code.
What is the problem and where is it occuring?
Sep 18 '07 #4
ak1dnar
1,584 Recognized Expert Top Contributor
@underscore

Is this mysql_query() is running when you loading the page for the very first time?

@code green
Please don't use "Alaxrand" again, Its too ugly. ;)
Sep 18 '07 #5
code green
1,726 Recognized Expert Top Contributor
Ajaxrand - Sorry slip of the fingers. 'l' and 'j' are only two keys apart.
underscore - You can get around this problem by employing basic techniques that should always be used.
I am referring to verifying POST data, especially before inserting into a database.
If you had placed these checks in the script it would help you greatly towards identifying the underlying problem,
which I still can't see by the way.
Sep 18 '07 #6
ak1dnar
1,584 Recognized Expert Top Contributor
First turn on the Error reporting. There are some instruction how to do that on the top of the php forum home page.
Why I am saying this, I didn't see the the opening "{" bracket for the "if" condition but closing bracket is there as the last line.
Sep 18 '07 #7
underscore
30 New Member
@underscore

Is this mysql_query() is running when you loading the page for the very first time?

@code green
Please don't use "Alaxrand" again, Its too ugly. ;)

yes sir! when i run the page the mysql was already runing. is thr wrong with it?
Sep 20 '07 #8
underscore
30 New Member
NO! ajaxrand did not try to help you, he tried to help the rest of us by removing chunks of code not relevant to the problem.
There is still far too much code.
What is the problem and where is it occuring?
ok sir. my problem is if i run those PHP code it will automatically save to mysql database. in the PHP at the buttom.
Sep 20 '07 #9
code green
1,726 Recognized Expert Top Contributor
Well you do have an if statement that controls nothing [PHP]if (isset($_POST["Submit"]))

include'package/connect.inc.php ';
mysql_select_db ('database');[/PHP]Looks like you are missing a brace after the if statement
Sep 20 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
4469
by: Chris Lobdell | last post by:
Hey, everyone. For the past two years, we have offered files for download through a secure website. Users, after clicking on a link, are redirected to a PHP page that passes the appropriate header information to the user and inquires if that user wishes to download the file. A sample of that code is below: header('Content-Type:...
3
1750
by: Ido | last post by:
Hello, I am searching for an automatic forms creation tool that will help me to save time in developin forms (preferrably with validation). My forms get some data from a MySQL database and are supposed to save all data back to the database. Any recommendations!?
19
3988
by: Mel | last post by:
when downloading files from my site, when file types are known (i.e *.doc) browsers open the file for viewing. is there a way to disable that and just present the save as dialog (same as for unknown types zip files etc.) ? thanks Mel
1
2225
by: Federico | last post by:
I want to create an automatic log system that writes to a ofstream (the logfile) all the output sent to screen. I tried to make a class COutput with the operator << overloaded for the different kind of data types, but a problem arrived when I tried to use io manipulators such as setprecision. I have this in class COutput: COutput&...
2
2109
by: ray | last post by:
I have a client that doesn't want Access to automatically repair into a backup file if it crashes (and it crashes only on very rare occasions). My (sketchy) understanding is that this is a Windows function that can't be stopped by using runtime switches, advanced options or other hi-falutin' database properties. Ami I correct that the...
6
2015
by: Mike Saunders | last post by:
I have a basic web site where people can download my programs. To make it easier for them is it possible that I could add some javascript that would allow them to automatically install/run the program for them maybe with appropriate options/warnings etc Sme example code would be most appreciated Many thanks
58
4611
by: Jorge Peixoto de Morais Neto | last post by:
I was reading the code of FFmpeg and it seems that they use malloc just too much. The problems and dangers of malloc are widely known. Malloc also has some overhead (although I don't know what is the overhead of automatic variable sized arrays, I suspect it is smaller than that of malloc), although I'm not too worried about it. I was...
6
3226
by: subhashkumar | last post by:
Running data Append to a table Dear All, I need a help from this forum, I was developing a small tools for stock market. I get stuck when trying to save the running changes in a data field value from a form to a table. Here I have two table and one form 1. LiveData - (Connected to external file which reflect the changes...
3
4631
by: Peter Hofmann | last post by:
When I change the source code and save it I have currently always to press explicitely F6 zu "compile" the code (and get new error list). Isn't there an automatic build function which is called whenever I save new code ? BTW: What is the difference between the two menues: Build->Build solution and
1
2931
by: TechieGrl | last post by:
I want to save a zip file daily. The file is named the same thing each day so I would like to create a folder and name it with today's date and then save the zip file into that folder. I'm using this code and can't seem to figure out how to create the new folder and save the file there. Any help is appreciated! $todays_date =...
0
7664
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7885
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7948
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6250
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3642
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.