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... -
-
<? session_start(); ?>
-
-
<head>
-
<title>My Page</title>
-
<style type="text/css">
-
<!--
-
#Layer1 {
-
position:absolute;
-
left:200px;
-
top:10px;
-
width:816px;
-
height:540px;
-
z-index:1;
-
}
-
.style3 {font-family: Arial, Helvetica, sans-serif}
-
.style4 {font-family: Arial}
-
a:link {
-
text-decoration: none;
-
}
-
a:visited {
-
text-decoration: none;
-
}
-
a:hover {
-
text-decoration: none;
-
}
-
a:active {
-
text-decoration: none;
-
}
-
.style14 {color: #FF0000; font-family: Geneva, Arial, Helvetica, sans-serif; }
-
-->
-
</style>
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-
</head>
-
-
<body>
-
-
<div id="Layer1">
-
<table width="808" height="538" border="0" cellpadding="0" cellspacing="0" bordercolor="#2A1F00">
-
<tr>
-
<td width="236" height="110"><img src="image/Nagano Header.jpg" width="236" height="110" alt="" /></td>
-
<td colspan="4"><img src="image/header.jpg" width="598" height="110" alt="" /></td>
-
</tr>
-
<tr>
-
<td height="22" colspan="5" bordercolor="#0000FF" bgcolor="#DAE2C7"><span class="style14">CREATE YOUR ID</span> </td>
-
</tr>
-
-
<form name="form1" method="post" action="register.php">
-
-
<tr>
-
<td height="42" bgcolor="#F7F7F7"><div align="right" class="style3">* First Name </div></td>
-
<td width="20" bgcolor="#F7F7F7"> </td>
-
<td width="159" bgcolor="#F7F7F7"><input name="txtfname" type="text" id="txtfname" /></td>
-
<td width="48" bgcolor="#F7F7F7"> </td>
-
<td width="364" bgcolor="#F7F7F7"><label></label></td>
-
</tr>
-
<tr>
-
<td height="25" bordercolor="#F7F3EF" bgcolor="#F7F7F7"><div align="right">* <span class="style4">Last Name</span> </div></td>
-
<td bordercolor="#F7F3EF" bgcolor="#F7F7F7"> </td>
-
<td bordercolor="#F7F3EF" bgcolor="#F7F7F7"><input name="txtlname" type="text" id="txtlname" /></td>
-
<td bordercolor="#F7F3EF" bgcolor="#F7F7F7"> </td>
-
<td bordercolor="#F7F3EF" bgcolor="#F7F7F7"><label></label></td>
-
</tr>
-
<tr>
-
<td height="36" bordercolor="#F7F3EF" bgcolor="#F7f7f7"><div align="right" class="style4">* Gender </div></td>
-
<td bordercolor="#F7F3EF" bgcolor="#F7F7F7"> </td>
-
<td bordercolor="#F7F3EF" bgcolor="#F7F7F7"><select name="mnugender" id="mnugender">
-
<option value="0">[Select]</option>
-
<option value="1">Male</option>
-
<option value="2">Female</option>
-
</select></td>
-
<td bordercolor="#F7F3EF" bgcolor="#F7F7F7"> </td>
-
<td bordercolor="#F7F3EF" bgcolor="#F7F7F7"><label></label></td>
-
</tr>
-
<tr>
-
<td height="34" bordercolor="#F7F3EF" bgcolor="#F7F7F7"><div align="right">* Log-in ID </div></td>
-
<td bordercolor="#F7F3EF" bgcolor="#F7F7F7"> </td>
-
<td bordercolor="#F7F3EF" bgcolor="#F7F7F7"><label>
-
<input name="txtlogid" type="text" id="txtlogid">
-
</label></td>
-
<td bordercolor="#F7F3EF" bgcolor="#F7F7F7"> </td>
-
<td bordercolor="#F7F3EF" bgcolor="#F7F7F7"> </td>
-
</tr>
-
<tr>
-
<td height="34" bordercolor="#F7F3EF" bgcolor="#F7F7F7"><div align="right" class="style4">* Password</div></td>
-
<td bordercolor="#F7F3EF" bgcolor="#F7F7F7"> </td>
-
<td bordercolor="#F7F3EF" bgcolor="#F7F7F7"><input name="txtpassword" type="password" id="txtpassword" /></td>
-
<td bordercolor="#F7F3EF" bgcolor="#F7F7F7"> </td>
-
<td bordercolor="#F7F3EF" bgcolor="#F7F7F7"> </td>
-
</tr>
-
-
<tr>
-
<td bordercolor="#F7F3EF" bgcolor="#F7F7F7"><div align="right" class="style4">* Re-type Password </div></td>
-
<td bordercolor="#F7F3EF" bgcolor="#F7F7F7"> </td>
-
<td bordercolor="#F7F3EF" bgcolor="#F7F7F7"><input name="txtretypepass" type="password" id="txtretypepass" /></td>
-
<td bordercolor="#F7F3EF" bgcolor="#F7F7F7"> </td>
-
<td bordercolor="#F7F3EF" bgcolor="#F7F7F7"><label></label></td>
-
</tr>
-
<tr>
-
<td height="38" bgcolor="#F7F7F7"><div align="right"><span class="style4">Birth Date </span></div></td>
-
<td bgcolor="#F7F7F7"> </td>
-
<td bgcolor="#F7F7F7"><select name="mnuMonth" id="mnuMonth">
-
<option value="0">[Select Month]</option>
-
<option value="1">January</option>
-
<option value="2">February</option>
-
<option value="3">March</option>
-
<option value="4">April</option>
-
<option value="5">May</option>
-
// OTHER OPTION VALUES 6-11 GOES HERE
-
<option value="12">December</option>
-
</select></td>
-
<td bgcolor="#F7F7F7"><label>
-
<select name="txtday" id="txtday">
-
<option value="1" selected>1</option>
-
<option value="2">2</option>
-
<option value="3">3</option>
-
// OTHER OPTION VALUES 3-30 GOES HERE
-
<option value="31">31</option>
-
</select>
-
</label></td>
-
<td bgcolor="#F7F7F7"><label>
-
<input name="txtyear" type="text" id="txtyear" value="yyyy" size="4">
-
</label></td>
-
</tr>
-
<tr>
-
<td height="39" bgcolor="#F7F7F7"><div align="right" class="style4">Zip/Postal code </div></td>
-
<td bgcolor="#F7F7F7"> </td>
-
<td bgcolor="#F7F7F7"><input name="txtzip" type="text" id="txtzip" /></td>
-
<td bgcolor="#F7F7F7"> </td>
-
<td bgcolor="#F7F7F7"> </td>
-
</tr>
-
<tr>
-
<td height="27" bgcolor="#F7F7F7"><div align="right"><span class="style4">* Email Address</span></div></td>
-
<td bgcolor="#F7F7F7"> </td>
-
<td bgcolor="#F7F7F7"><input name="txtemailadd" type="text" id="txtemailadd" /></td>
-
<td bgcolor="#F7F7F7"> </td>
-
<td bgcolor="#F7F7F7"> </td>
-
</tr>
-
-
<tr>
-
<td height="33" bgcolor="#F7F7F7"><div align="right" class="style4">User Access Level </div></td>
-
<td bgcolor="#F7F7F7"> </td>
-
<td bgcolor="#F7F7F7"><label>
-
<select name="mnuAccess" id="mnuAccess">
-
<option value="0">[Select Level]</option>
-
<option value="1">Administrator</option>
-
<option value="2">Limited</option>
-
</select>
-
</label></td>
-
<td bgcolor="#F7F7F7"> </td>
-
<td bgcolor="#F7F7F7"> </td>
-
</tr>
-
<tr>
-
<td height="19" bgcolor="#F7F7F7"> </td>
-
<td bgcolor="#F7F7F7"> </td>
-
<td bgcolor="#F7F7F7"><label></label></td>
-
<td bgcolor="#F7F7F7"> </td>
-
<td bgcolor="#F7F7F7"> </td>
-
</tr>
-
<tr>
-
<td bgcolor="#F7F7F7"><a href="index.html" target="_parent"></a></td>
-
<td bgcolor="#F7F7F7"> </td>
-
<td bgcolor="#F7F7F7"><input name="Submit" type="Submit" class="style4" id="Submit" value=" Submit " onClick="javascript:alert('Your form has been submitted')">
-
<td bgcolor="#F7F7F7"> </td>
-
<td bgcolor="#F7F7F7"> </td>
-
</tr>
-
-
<tr>
-
<td height="24" colspan="5" bgcolor="#F7F7F7"><div align="left">
-
<blockquote>
-
<blockquote>
-
<blockquote>
-
<blockquote>
-
<blockquote>
-
<blockquote>
-
<p><a href="index.html" target="_parent"><strong>BACK TO HOME PAGE </strong></a></p>
-
</blockquote>
-
</blockquote>
-
</blockquote>
-
</blockquote>
-
</blockquote>
-
</blockquote>
-
</div></td>
-
</tr>
-
<tr>
-
<td bgcolor="#F7F7F7"><div align="right" class="style4"><a href="index.html" target="_parent"></a></div></td>
-
<td bgcolor="#F7F7F7"> </td>
-
<td bgcolor="#F7F7F7"><a href="index.html" target="_parent"></a></td>
-
<td bgcolor="#F7F7F7"> </td>
-
<td bgcolor="#F7F7F7"><label></label></td>
-
</tr>
-
</table>
-
-
</div>
-
</body>
-
</html>
-
-
<?php
-
-
if (isset($_POST["Submit"]))
-
-
include'package/connect.inc.php';
-
mysql_select_db('database');
-
-
$user_sql = "INSERT INTO userpass(loginId,fname,lname,gender,password,repassword,bdate,zip,emailadd,accesslevel,regdate,reghours)
-
values('". $_POST["txtlogid"] ."','". $_POST["txtfname"] ."','". $_POST["txtlname"] ."',
-
'". $_POST["mnugender"] ."','". $_POST["txtpassword"] ."',
-
'". $_POST["txtretypepass"]."','". $_POST["mnuMonth"]."-". $_POST["txtday"]."-". $_POST["txtyear"]."',
-
'". $_POST["txtzip"]."',
-
'". $_POST["txtemailadd"]."','". $_POST["mnuAccess"]."',
-
'". date("F j, Y, g:i a")."','". date("H:i:s A")."')";
-
$result = mysql_query($user_sql);
-
-
}
-
?>
-
13 2629
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.
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
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?
@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. ;)
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.
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.
@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?
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.
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
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
ok in my code that is pair ( { } ) in if statement. but the same it will automatically save.
ok in my code that is pair ( { } ) in if statement. but the same it will automatically save.
If the $_POST["Submit"] button has been clicked you will write to the database.
If you are writing to the database without clicking then your php code is wrong.
Can you show the true version (please leave out the HTML)
If the $_POST["Submit"] button has been clicked you will write to the database.
If you are writing to the database without clicking then your php code is wrong.
Can you show the true version (please leave out the HTML)
this is the php code:
<?php
if (isset($_POST["Submit"]))
{
include'package/connect.inc.php';
mysql_select_db('database');
$user_sql = "INSERT INTO userpass(loginId,fname,lname,gender,password,repas sword,bdate,zip,emailadd,accesslevel,regdate,regho urs)
values('". $_POST["txtlogid"] ."','". $_POST["txtfname"] ."','". $_POST["txtlname"] ."',
'". $_POST["mnugender"] ."','". $_POST["txtpassword"] ."',
'". $_POST["txtretypepass"]."','". $_POST["mnuMonth"]."-". $_POST["txtday"]."-". $_POST["txtyear"]."',
'". $_POST["txtzip"]."',
'". $_POST["txtemailadd"]."','". $_POST["mnuAccess"]."',
'". date("F j, Y, g:i a")."','". date("H:i:s A")."')";
$result = mysql_query($user_sql);
}
?>
ok sir. my problem is if i run those PHP code it will automatically save to mysql database. in the PHP at the buttom
If below is the correct opening of the php code
[PHP]if (isset($_POST["Submit"]))
{[/PHP]And this is the correct HTML for the submit button
[HTML]"><input name="Submit" type="Submit" [/HTML]
Then what we seem to be missing now is a closing form tag [HTML]</form>[/HTML]
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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,...
|
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...
| |