good day! Im a newbie in PHP and i really need your help
this is my problem actually there's no error in my code when i run it, but when i press save the data does not save to the database. please help me i really need to finish it here's my code:
This Is my form - <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
<html xmlns="http://www.w3.org/1999/xhtml">
-
<head>
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-
<title>Untitled Document</title>
-
</head>
-
-
<body>
-
<form id="form1" name="form1" method="post" action="">
-
<label>Ref Num:
-
<input name="ref_num" type="text" tabindex="1" maxlength="5" />
-
</label>
-
<input type="submit" name="search" value="Search" />
-
-
<p>
-
<label>Client:
-
<input name="client" type="text" id="client" maxlength="50" />
-
</label>
-
<label> Department:</label>
-
<select name="dept" size="1" id="dept" tabindex="4">
-
<option selected="selected">Choose Dept</option>
-
<option value="Accounting">Accounting</option>
-
<option value="Engineering">Engineering</option>
-
<option value="Finishing">Finishing Goods</option>
-
<option value="HRAD">HRAD</option>
-
<option value="MIS">MIS</option>
-
<option value="PD">Packaging & Design</option>
-
<option value="Prod">Production</option>
-
<option value="Purchasing">Purchasing & Logistics</option>
-
<option value="QA">QA & Technical</option>
-
<option value="Supply">Supply Chain</option>
-
</select>
-
<label></label>
-
</p>
-
<p> Logger:
-
<input name="logger" type="text" id="logger" tabindex="5" maxlength="50" />
-
Status
-
<select name="stat" id="stat">
-
<option value="Pending">Pending</option>
-
<option value="Done">Done</option>
-
</select>
-
</p>
-
<p>Problem:
-
-
Aging:
-
<label>Report is 1 day old!</label> </p>
-
<textarea name="prob" cols="70" rows="10" id="prob" tabindex="6"></textarea>
-
</p>
-
<p>
-
<input type="Submit" name="Save" value="Save" tabindex="7"form action = "reg2.php" method "POST" />
-
<input name="print" type="submit" id="print" tabindex="9" value="Print" />
-
<input name="cancel" type="submit" id="cancel" tabindex="10" value="Cancel" />
-
-
<input name="update" type="submit" id="update" tabindex="8" value="Update" />
-
</p>
-
<p> </p>
-
</form>
And this is my cconnection: - <?php
-
include "config.php";
-
{
-
$Submit = $_POST["Submit"];
-
$ref_num = $_POST["ref_num"];
-
$client = $_POST["client"];
-
$logger = $_POST["logger"];
-
$dept = $_POST["dept"];
-
$problem = $_POST["problem"];
-
$status = $_POST["status"];
-
$aging = $_POST["aging"];
-
$DATE = DATE ("Y-m-d");
-
-
}
-
-
$query ="INSERT INTO tbl_log (ref_num,client,loggr,dept,problem,status,aging,) VALUES ('$ref_num','$client','$logger', '$dept','$problem','$status','$aging');"
-
-
?>
-
<html>
-
<body>
-
Successfully save! <a href="http://localhost:8080/file:/D:/xampp/htdocs/OJT/jim&jaz/try.php?DBGSESSID=-1&PHPEdHidden=20888">Refresh</a>
-
</body>
-
</html>
Please tell what's wrong with it...
as i trace it it said to be like this
undefined = null
and in my database:
Connection for controluser as defined in your configuration failed.
3 1587
It may not be saving for a number of reasons.
Having "no error in my code" simply means it compiles alrignt.
You need to put some tests inside your code.
Echo out the $_POST variables, are they empty?
Echo out the query, does it work directly?
I assume connection code is in include "config.php"
Is this working?
If the code isn't working as intended, then there is an error in the code.
You haven't defined a connection. But also, you defined a query string but you don't execute it.
Thank you for the comments and sorry for the grammar, I'll try to check my code, sorry i'm new to PHP that's why there are so many syntax that i dont know, and I dont have any backgroud to PHP but i really really want to know more about PHP hope you can help me explore PHP.
Once again thank you.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Haoyu Zhang |
last post by:
Dear Friends,
Python assignment is a reference assignment. However, I really can't
explain the difference in the following example. When the object is
a list, the assignment seems to be a...
|
by: Brian Roberts |
last post by:
I'm confused about the use of hasattr/getattr, or possibly
namespaces. I know how to do this:
class UnderstandThis(object):
def do_foo(self): pass
def do_bar(self): pass
def doit(self, cmd):...
|
by: Ohaya |
last post by:
Hi,
I'm trying to understand a situation where ASP seems to be "blocking" of
"queuing" requests. This is on a Win2K Advanced Server, with IIS5.
I've seen some posts (e.g.,...
|
by: ree32 |
last post by:
I am a bit confused with capabilities of XML.
I have an XML document with information on images(photos). Is there way
to use XSL/XSLT to create a page that will display the images as
gallery.
...
|
by: Jeff Amiel |
last post by:
Yes, I've read the FAQ's...
I'm still confused.
I'm trying to help out a buddy to extract data from an .mdb file that
has special 'permissions' on it.
If I try to open it with the standard...
|
by: Lauren Wilson |
last post by:
Ok I have searched the MS website for info on this. I am totally
confused.
If I want to deploy an Access 2003 app and allow my users to run it
using Access 2003 Runtime, where do I get the...
|
by: Benny Ng |
last post by:
Hi,All,
Export Method:
-------------------------------------------------------------------------
strFileNameExport = "Results"
Response.Clear()
Response.Buffer = True...
|
by: Daniel |
last post by:
I'm new to .Net and all of its abilities so I hope this makes sense.
Basically I'm confused on when is the appropriate time to use web forms
controls vs. regular HTML.
For example in ASP...
|
by: timmu |
last post by:
Someone asked me a question about integer division and printf
yesterday,
I tell him he should do a casting to float/double before you do any
interger division.
But he doesn't think so, so I try...
|
by: Peter |
last post by:
Hi,
I have a problem with Listview using checkboxes.
If i check items by code BEFORE the form is shown the Listview.Items
are confused during the ItemChecked Event !!!
After showing the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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...
| |