473,387 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Why won't data save in PHP code?

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
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Untitled Document</title>
  6. </head>
  7.  
  8. <body>
  9. <form id="form1" name="form1" method="post" action="">
  10.   <label>Ref Num: 
  11.   <input name="ref_num" type="text" tabindex="1" maxlength="5" />
  12.   </label>
  13.   <input type="submit" name="search" value="Search" />
  14.  
  15.   <p>
  16.     <label>Client: &nbsp;&nbsp;&nbsp;&nbsp;
  17.     <input name="client" type="text" id="client" maxlength="50" />
  18.     </label>
  19.     <label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Department:</label>
  20.     <select name="dept" size="1" id="dept" tabindex="4">
  21.       <option selected="selected">Choose Dept</option>
  22.       <option value="Accounting">Accounting</option>
  23.       <option value="Engineering">Engineering</option>
  24.       <option value="Finishing">Finishing Goods</option>
  25.       <option value="HRAD">HRAD</option>
  26.       <option value="MIS">MIS</option>
  27.       <option value="PD">Packaging &amp; Design</option>
  28.       <option value="Prod">Production</option>
  29.       <option value="Purchasing">Purchasing &amp; Logistics</option>
  30.       <option value="QA">QA &amp; Technical</option>
  31.       <option value="Supply">Supply Chain</option>
  32.     </select>
  33.     <label></label>
  34.   </p>
  35.       <p> Logger:&nbsp;&nbsp;&nbsp;
  36.     <input name="logger" type="text" id="logger" tabindex="5" maxlength="50" />
  37.     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Status &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  38.     <select name="stat" id="stat">
  39.       <option value="Pending">Pending</option>
  40.       <option value="Done">Done</option>
  41.     </select>
  42.   </p>
  43.   <p>Problem: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  44.  
  45.   Aging:
  46.   <label>Report is 1 day old!</label>    </p>
  47.     <textarea name="prob" cols="70" rows="10" id="prob" tabindex="6"></textarea>
  48.   </p>
  49.   <p>
  50.     <input type="Submit" name="Save" value="Save" tabindex="7"form action = "reg2.php" method "POST" />
  51.     <input name="print" type="submit" id="print" tabindex="9" value="Print" />
  52.     <input name="cancel" type="submit" id="cancel" tabindex="10" value="Cancel" />
  53.     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  54.     <input name="update" type="submit" id="update" tabindex="8" value="Update" />
  55.   </p>
  56.   <p>&nbsp;</p>
  57. </form>



And this is my cconnection:



Expand|Select|Wrap|Line Numbers
  1. <?php
  2. include "config.php"; 
  3. {
  4. $Submit = $_POST["Submit"];
  5. $ref_num = $_POST["ref_num"];
  6. $client = $_POST["client"];
  7. $logger = $_POST["logger"];
  8. $dept = $_POST["dept"];
  9. $problem = $_POST["problem"];
  10. $status = $_POST["status"];
  11. $aging = $_POST["aging"];
  12. $DATE = DATE ("Y-m-d");
  13.  
  14. }
  15.  
  16.  $query ="INSERT INTO tbl_log (ref_num,client,loggr,dept,problem,status,aging,) VALUES ('$ref_num','$client','$logger',  '$dept','$problem','$status','$aging');"
  17.  
  18. ?>
  19. <html>
  20. <body>
  21. Successfully save! <a href="http://localhost:8080/file:/D:/xampp/htdocs/OJT/jim&jaz/try.php?DBGSESSID=-1&PHPEdHidden=20888">Refresh</a>
  22. </body>
  23. </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.
Apr 6 '11 #1
3 1587
code green
1,726 Expert 1GB
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?
Apr 6 '11 #2
Rabbit
12,516 Expert Mod 8TB
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.
Apr 6 '11 #3
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.
Apr 10 '11 #4

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

Similar topics

5
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...
2
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):...
11
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.,...
6
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. ...
5
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...
10
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...
1
by: Benny Ng | last post by:
Hi,All, Export Method: ------------------------------------------------------------------------- strFileNameExport = "Results" Response.Clear() Response.Buffer = True...
2
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...
11
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...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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$) { } ...
0
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...
0
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
1
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...
0
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...
0
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,...
0
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...
0
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...

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.