Jump to content
The Uniform Server Community

dreeves

Member
  • Posts

    13
  • Joined

  • Last visited

Previous Fields

  • Main OS
    Windows XP

dreeves's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. When I started over and retyped it, it worked just fine. Thanks for your help!
  2. I made the changes but "No" is not appearing. Just to be sure I'm getting this right: This line goes in the form html <INPUT TYPE=CHECKBOX NAME="Direct_Pay" value="Yes"> Amount should be paid directly paid to contractor And this code goes in the php insert script // Set variable $directPay = ''; // If Direct Pay is set (checked) and value of it is Yes... if ( isset($_POST['Direct_Pay']) && $_POST['Direct_Pay'] == "Yes" ) { // Set variable to yes $directPay = 'Yes'; } else { // Set variable to No $directPay = 'No'; } // Do query after the above check mysql_query("INSERT INTO table_name (Name, Address, Email, Direct_Pay) VALUES ('$Name', '$Address', '$Email', '$directPay')"); When the box is unchecked, "No" is not entered into the table. Did you distinct between directPay and Direct_Pay correctly?
  3. Great. That helps to see it written out like that. 'Direct_Pay' is one of many form inputs. I had constructed one single query that inserts all the variables into a database record. Is there a way I could store 'Yes' or 'No' in a variable so that it gets inserted into the correct record? Ideally, the query in my php script would be: INSERT INTO table_name (Auto_Increment_ID, Name, Address, Email, Direct_Pay) VALUES ('', '$Name', '$Address', '$Email', '$Direct_Pay'); If I have a separate INSERT query for Direct_Pay, as described in your response, it will insert it as a unique record with the other 4 fields not filled in. If I understand correctly. Is there a way to store the Yes/No as a variable?
  4. kalpz, That makes a little more sense. I am new to php, so I'm not quite sure what to put to fill in your comments like: // Insert yes into DB //otherwise if not set and value is not Yes. insert no //Insert no into DB I know that you couldn't explain it any simpler to me, but could you clarify or elaborate?
  5. In my script, all the records in the database are output into a table. One of the columns is the primary key (Invoice Number). I would like for each Invoice Number to be a link, so when selected the user will be directed to a page where they can see and edit the entire record (invoice). How would I do that? I already have a page written that will display the information, I just don't have a way of telling it which record to display. Here is the code: <? include("dbinfo.inc.php"); mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM contacts"; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); echo "<b><center>Database Output</center></b><br><br>"; ?> <table border="0" cellspacing="2" cellpadding="2"> <tr> <th><font face="Arial, Helvetica, sans-serif">Invoice Number</font></th> <th><font face="Arial, Helvetica, sans-serif">Name</font></th> <th><font face="Arial, Helvetica, sans-serif">Phone</font></th> <th><font face="Arial, Helvetica, sans-serif">Mobile</font></th> <th><font face="Arial, Helvetica, sans-serif">Fax</font></th> <th><font face="Arial, Helvetica, sans-serif">E-mail</font></th> <th><font face="Arial, Helvetica, sans-serif">Website</font></th> </tr> <? $i=0; while ($i < $num) { $Invoice_Number=mysql_result($result,$i,"Invoice_Number"); $first=mysql_result($result,$i,"first"); $last=mysql_result($result,$i,"last"); $phone=mysql_result($result,$i,"phone"); $mobile=mysql_result($result,$i,"mobile"); $fax=mysql_result($result,$i,"fax"); $email=mysql_result($result,$i,"email"); $web=mysql_result($result,$i,"web"); ?> <tr> <td><font face="Arial, Helvetica, sans-serif"><? echo "$Invoice_Number"; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><? echo "$first $last"; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><? echo "$phone"; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><? echo "$mobile"; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><? echo "$fax"; ?></font></td> <td><font face="Arial, Helvetica, sans-serif"><a href="mailto:<? echo "$email"; ?>">E-mail</a></font></td> <td><font face="Arial, Helvetica, sans-serif"><a href="<? echo "$web"; ?>">Website</a></font></td> </tr> <? ++$i; } echo "</table>"; ?>
  6. I've figured it out, I insert a hidden form field with the same name as the checkbox and the default value right before the place where the checkbox is located. So... <input type="hidden" name="Direct_Pay" value="No" /> <INPUT TYPE=CHECKBOX NAME="Direct_Pay" value="Yes"> Amount should be paid directly paid to contractor This worked great. When unchecked, "No" is input to the database by default.
  7. Here is the code for the checkbox: <TD><INPUT TYPE=CHECKBOX NAME="Direct_Pay" value="yes"> Amount should be paid directly paid to contractor</TD> That info is sent to insert.php which inserts the info into a mysql database. Line 22 of insert.php states: (line 22) $Direct_Pay=$_POST['Direct_Pay']; When the user "checks" the box, it works fine. When the user does not check the box, the error logs states: [error] [client 127.0.0.1] PHP Notice: Undefined index: Direct_Pay in C:\\wamp\\www\\insert.php on line 22, referer: http://localhost/form.html
  8. I have changed that, but it is still not working properly. As it appears, there is a combo box, then an input field to the right (useful for "Other, please specify:"). Whatever I put in that box will appear in my database, but I would like the combo box selection to appear instead. Because the Internet offers so many different solutions, it was a little overwhelming. I was hoping to get a simple solution here.
  9. I have some simple HTML code for a combo box on a form. When I submit the form, all the fields get entered into the mysql database successfully, except for the field in which I used a combo box. It appears in the browser as a combo box with another empty input field to the right of it. Here is the code, it is part of a table: <TD><select name="Practice_Code"> <option selected> Please Select</option> <option value="1.01A">1.01A</option> <option value="1.01B">1.01B</option> <option value="1.02">1.02</option> <option value="1.03">1.03</option> <option value="1.04">1.04</option> <option>Other, please specify:</option> </select> <input type= "text" name="Practice_Code"/></TD> I've never used Java, so I was hoping to avoid it unless I have to use it in this case. Thanks.
  10. When I submit form.html, it sends the info to insert.php and successfully enters the info into a mysql database. However, I get "Problem loading Page: The connection to the server was reset while the page was loading." I have to restart the servers inorder for apanel/phpMyAdmin to work again. From the error log, I think the problem occurs when attempting to close the connection to the mysql database. Here is the error: - [Wed Oct 14 09:39:38 2009- ] [notice] EACCELERATOR(3332): PHP crashed on opline 99 of mysql_close() at C:\UniServer\www\insert.php:33 - [Wed Oct 14 09:39:38 2009] [crit] Parent: child process exited with status 3 -- Aborting. - [Wed Oct 14 09:39:59 2009] [notice] Apache/2.2.14 (Win32) mod_ssl/2.2.14 OpenSSL/0.9.8k PHP/5.3.0 DAV/2 configured -- resuming normal operations - [Wed Oct 14 09:39:59 2009] [notice] Server built: Sep 28 2009 22:41:08 - [Wed Oct 14 09:39:59 2009] [notice] Parent: Created child process 3024 - [Wed Oct 14 09:40:00 2009] [notice] Child 3024: Child process is running - [Wed Oct 14 09:40:00 2009] [notice] Child 3024: Acquired the start mutex. - [Wed Oct 14 09:40:00 2009] [notice] Child 3024: Starting 250 worker threads. - [Wed Oct 14 09:40:00 2009] [notice] Child 3024: Starting thread to listen on port 443. - [Wed Oct 14 09:40:00 2009] [notice] Child 3024: Starting thread to listen on port 80. I've numbered the lines of code for you and eliminated some things for convenience. Does the "33" mean that the problem is on line 33 of insert.php? Is it something to do with EACCELERATOR? (29) $query="INSERT INTO reimbursements (column_name1, column_name2) VALUES (value1, value2)"; (30) mysql_query($query) or die("reimbursements insert failed - " . mysql_errno() . ": " . (31) mysql_error()); (33)mysql_close(); I'm happy that data finally gets entered, but Apache shouldn't crash every time I submit this form. Thanks for being so helpful.
  11. Thanks. That worked. Now I'm dealing with html/form/php code issues. It never seems to end.
  12. Thanks! Just a quick question though about updating to the new version, Do I need to uninstall the old version? I have 5.1 directly on C:// and when installing 5.3 it wants to replace some files. What is the best way to update to 5.3 without losing any work I've done in 5.1? Apache/php/mysql is new to me, so I'm not 100% on how it all works together. Any guidance would be appreciated.
  13. I've seen this problem all over the Internet, but since I'm using Uniform Server, I was hoping to get a solution that was catered to US. Here are the details: Apache/2.2.13 (Win32) mod_ssl/2.2.13 OpenSSL/0.9.8k PHP/5.3.0 DAV/2 I am entering information into a form, which then gets put on to a mysql database. When I submit the form, the page displays "The connection to the server was reset while the page was loading." The data gets entered in the database successfully, however. The error log displays: - [Fri Oct 09 16:42:05 2009] [notice] Parent: child process exited with status 3221225477 -- Restarting. - [Fri Oct 09 16:42:06 2009] [notice] Apache/2.2.13 (Win32) mod_ssl/2.2.13 OpenSSL/0.9.8k PHP/5.3.0 DAV/2 configured -- resuming normal operations - [Fri Oct 09 16:42:06 2009] [notice] Server built: Aug 6 2009 15:50:50 - [Fri Oct 09 16:42:06 2009] [notice] Parent: Created child process 3456 - [Fri Oct 09 16:42:07 2009] [notice] Child 3456: Child process is running - [Fri Oct 09 16:42:07 2009] [notice] Child 3456: Acquired the start mutex. - [Fri Oct 09 16:42:07 2009] [notice] Child 3456: Starting 250 worker threads. - [Fri Oct 09 16:42:07 2009] [notice] Child 3456: Starting thread to listen on port 443. - [Fri Oct 09 16:42:07 2009] [notice] Child 3456: Starting thread to listen on port 80. One solution I've tried was to copy the libmysql.dll file from the PHP installation folder to the system32 folder. That did not work. Since I downloaded this just a few days ago, I didn't think that there were any updates required. Let me know if you would like me to include the php code, in case that will help.
×
×
  • Create New...