Jump to content

Clinton

Members
  • Posts

    337
  • Joined

  • Last visited

Posts posted by Clinton

  1. Wow thanks. That will help out I'm sure. Question about that... when I do that I get the result

     

    2007- 04-12

     

    There is a space between the - and the 04 and my DB is still not updating. Anyway to get rid of that space? I was just trying to mess with the code but can's seem to figure it out.

  2. Didn't do the trick.

     

    
    $dbhandle = mysql_connect($hostname, $username, $password)
    or die("Unable to connect to MySQL");
    echo "Connected to Server<br>";
    
    mysql_select_db("clintona_SLC",$dbhandle)
    or die("Can not open SLC Database");
    echo "Connected to Salt Lake City Database<p>";
    
    mysql_query("UPDATE training SET firstaidcpr = $facpr WHERE id=$id");
    
    echo "Database has been updated. You will be returned to the training page momentarily. <meta http-equiv='refresh' content='3;URL=training.php' >"
    
    ?>
    
    <html>
    <head>
    <title>Database is Updating...</title>
    </head>
    
    
    <body bgcolor="#FFFFFF">
    
    </body>
    
    
    </html>
    
    

  3. Not Updating... Not sure why...

     

    <?
    $id = $_GET["id"];
    
    $facpr = $_GET["facpr"];
    ?>
    
    <?php
    $username = "*****";
    $password = "*****";
    $hostname = "localhost";
    
    $dbhandle = mysql_connect($hostname, $username, $password)
    or die("Unable to connect to MySQL");
    echo "Connected to Server<br>";
    
    $selected = mysql_select_db("*****",$dbhandle)
    or die("Can not open SLC Database");
    echo "Connected to Salt Lake City Database<p>";
    
    mysql_query("UPDATE training SET firstaidcpr = '$facpr' WHERE id='$id'");
    
    echo "Database has been updated. You will be returned to the training page momentarily. <meta http-equiv='refresh' content='3;URL=training.php' >"
    
    ?>
    
    <html>
    <head>
    <title>Database is Updating...</title>
    </head>
    
    
    <body bgcolor="#FFFFFF">
    
    </body>
    
    
    </html>
    

  4. Well for the code I posted there is no errors. It just shows the link address instead of making it hyper. I want to be able to click on it. I tried stopping the php code ?> and starting it after some html <?... oh I just tried to change it again and I"m not getting errors but it's just posting the code:

     

    This is what showed up in my e-mail when I tried to start and stop code:

     

    Logon ?> <a href='http://test'>here</a> <?to view your status.";

  5. I'm trying to get the html to show in the e-mail (so 'here' is highlighted and they can click on it) but instead it just shows the link. I've tried a couple of things but am getting errors. How do I go about doing this? Thank you.

     

    <?
    
    $query = "UPDATE users SET First='$first', MI='$mi', Last='$last', Phone='$homephone', Email='$email', CellPhone='$CellPhone', Username='$username', Status='$status' WHERE ID='$id'";
    $result = mysql_query($query)or die(mysql_error());
    
    $to = "$email";
    $subject = "Your California Office Database Registration";
    $body = "Hi, $first $last. Your access to the California Office Database has been modified. Logon <a href='test.php'>here</a> to view your status.";
    if (mail($to, $subject, $body)) {
    echo("<p>An e-mail to the user has gone out. <a href='index.php'>Return</a><br></p>");
    } else {
    echo("<p>The e-mail FAILED to go out.</p>");
    echo("The registration information has been updated. <a href='index.php'>Return</a><br>");
    }
    }
    ?>

  6. I've got a master inventory list that includes the Item Description, it's location, and quantity. If I have duck tape in 3 places it will show:

     

    Duck Tape - Office - 2

    Duck Tape - Shop - 27

    Duck Tape - Trailer - 1

     

    Can I combine all the duck tapes (and there are other multiples in this list that would need to be combined as well) it so the master list says:

     

    Duck Tape - 30

    Etc...

     

    ????

  7. Yea, after doing a little searching I found something that is pretty much what I need, I'd imagine, I just don't know how to alter it for my use and the javascript area is not very hoppin. Anybody here got any javascript experience?

     

    <html>
    <head>
    <meta name="generator" content="PhpED Version 4.5 (Build 4513)">
    <script language="javascript1.1">
            function summate() {
            	var tot=0
            	for (var i=1; i <= 5; i++) {
            		var id = "txt"+i;
            	    tot = tot + document.getElementById(id).value*1;
            	}
            	document.getElementById("tot").value = tot;
            }
    </script>
    </head>
    <body>
    <form>
    <table width=50% bgcolor="#FFFFFF" cellspacing=1 cellpadding=2>
    <tr bgcolor=""> 	      
      <td><b>One</b></td>
      <td><input type="text" id="txt1" onChange="summate()"></td>
    </tr>
    <tr bgcolor=""> 	      
      <td><b>Two</b></td>
      <td><input type="text" id="txt2" onChange="summate()"></td>
    </tr>	 
    <tr bgcolor=""> 	      
      <td><b>Three</b></td>
      <td><input type="text" id="txt3" onChange="summate()"></td>
    </tr>
    <tr bgcolor=""> 	      
      <td><b>Four</b></td>
      <td><input type="text" id="txt4" onChange="summate()"></td>
    </tr>	 
    <tr bgcolor=""> 	      
      <td><b>Five</b></td>
      <td><input type="text" id="txt5" onChange="summate()"></td>
    </tr>
    <tr bgcolor=""> 	      
      <td><b>TOTAL</b></td>
      <td><input type="text" id="tot"></td>
    </tr>	 
    
    </table>
    </form>
    </body>
    </html>
    

  8. I have a form. If I put in 5 for 'Quantity' and '1.00' for UnitCost when I go to TotalCost I want it to automatically compute the total. In this case 5.00. Make sense? How do I do this?

     

    <tr><td>Quantity:</td><td>
    <input type="text" name="Quantity">
    </td></tr>
    <tr><td>Unit Cost:</td><td>
    <input type="text" name="UnitCost">
    </td></tr>
    <tr><td>Total Cost:</td><td>
    <input type="text" name="TotalCost">
    </td></tr>
    

     

     

    ---

     

    P.S. I found this which is probably what I want but I'm not sure how to modify it for my purposes:

     

    <script language="javascript1.1">

            function summate() {

            var tot=0

            for (var i=1; i <= 5; i++) {

            var id = "txt"+i;

                tot = tot + document.getElementById(id).value*1;

            }

            document.getElementById("tot").value = tot;

            }

    </script>

  9. I have a form. If I put in 5 for 'Quantity' and '1.00' for UnitCost when I go to TotalCost I want it to automatically compute the total. In this case 5.00. Make sense? How do I do this?

     

    <tr><td>Quantity:</td><td>
    <input type="text" name="Quantity">
    </td></tr>
    <tr><td>Unit Cost:</td><td>
    <input type="text" name="UnitCost">
    </td></tr>
    <tr><td>Total Cost:</td><td>
    <input type="text" name="TotalCost">
    </td></tr>
    

     

    (And yes, I know this isn't exactly PHP but the HTML forum is virtually non-existent and I know there's a genius in here right now!)

  10. I have a form. If I put in 5 for 'Quantity' and '1.00' for UnitCost when I go to TotalCost I want it to automatically compute the total. In this case 5.00. Make sense? How do I do this?

     

    <tr><td>Quantity:</td><td>
    <input type="text" name="Quantity">
    </td></tr>
    <tr><td>Unit Cost:</td><td>
    <input type="text" name="UnitCost">
    </td></tr>
    <tr><td>Total Cost:</td><td>
    <input type="text" name="TotalCost">
    </td></tr>
    

  11. Help. Please.

     

    Error:

    Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/anderse/public_html/NAIS/8321/inc/register.php on line 47

     

    It has something to do with my $_POST's. Tried a couple of different things. Nothing working.

     

     

    <?php
    $to = "me@gmail.com";
    $subject = "8321 User Registration";
    $body = "Hi, '".$_POST['First']."', '".$_POST['Last']."' has requested access to the Database. $_POST['Email'] ";
    if (mail($to, $subject, $body)) {
    echo("<p>You will receive an e-mail when the administrator approves your account.</p>");
    } else {
    echo("<p>Please contact the administrator <a href='mailto:me@gmail.com'>here</a> for account access.</p>");
    }
    
    ?>
    

  12. All the variables are being passed correctly, the table name and columns are correct, no errors are being generated... but the information is not being inserted into my db. Any ideas?

     

     

    <?
    mysql_connect("localhost", "******", "********") or die(mysql_error());
    mysql_select_db("anderse_inventory") or die(mysql_error());
    
    mysql_query("INSERT INTO roster (Name, Title, CellPhone, HomePhone, Email, Notes, Position, Terminated)
    VALUES ('".$_POST['Name1']."', '".$_POST['Title1']."', '".$_POST['CellPhone1']."', '".$_POST['HomePhone1']."', '".$_POST['Email1']."', '".$_POST['Notes1']."', '".$_POST['Position1']."', '".$_POST['Terminated1']."')");
    
    ?>
    
    <? echo $_POST['Name1']?> has been added to the database. <a href="keyper2.php">Return</a><br>
    
    <? echo $_POST['Title1']?><br>
    
    <? echo $_POST['CellPhone1']?><br>
    
    <? echo $_POST['HomePhone1']?><br>
    
    <? echo $_POST['Email1']?><br>
    
    <? echo $_POST['Notes1']?><br>
    
    <? echo $_POST['Position1']?><br>
    
    <? echo $_POST['Terminated1']?><br>
    

  13. Well I figured it would have something to do with my ID but i'm not quite sure what just because it's a loop and not fixed text:

     

    
    
    <?
    $q4= "SELECT * FROM roster WHERE `Position`<='4' AND `Terminated`='0' ORDER BY Position";
    $q4rz=mysql_query($q4) or die(mysql_error());
    
    while($row4 = mysql_fetch_array($q4rz)){
    ?>
    
    <form action="updatekeyper.php" method="post">
    <table border="0">
    <tr><td>Name:</td><td>
    <input type="text" name="Name" maxlength="60" value="<? echo $row4['Name']; ?>"><input type="hidden" name="ID" maxlength="60" value="<? echo $row4['ID']; ?>">
    </td></tr>
    <tr><td>Title:</td><td>
    <input type="text" name="Title" maxlength="60" value="<? echo $row4['Title']; ?>">
    <tr><td>Cell Phone:</td><td>
    <input type="text" name="CellPhone" maxlength="60" value="<? echo $row4['CellPhone']; ?>">
    <tr><td>Home Phone:</td><td>
    <input type="text" name="HomePhone" maxlength="60" value="<? echo $row4['HomePhone']; ?>">
    <tr><td>E-Mail:</td><td>
    <input type="text" name="Email" maxlength="60" value="<? echo $row4['Email']; ?>">
    <tr><td>Notes:</td><td>
    <input type="text" name="Notes" maxlength="200" value="<? echo $row4['Notes']; ?>">
    </td></tr>
    <tr><td>Position:</td><td>
    <select name="Position" size="1">
    <option value="0">Explosive Manager</option>
    <option value="1">Explosive Supervisor</option>
    <option value="2">Class 1 Explosive Technician</option>
    <option value="3">Class 2 Explosive Technician</option>
    <option value="4">Class 3 Explosive Technician</option>
    <option value="5">Standby Personnel</option>
    </select>
    </td></tr>
    <tr><td>Terminated:</td><td>
    <select name="Terminated" size="1">
      <option value="0">No</option>
      <option value="1">Yes</option>
      </select>
    </td></tr>
    </table>
    </form>
    
    <p>
    
    
    <?
    }
    ?>
    

  14. Ok, I have this page that has this code:

     

    <?
    $q1= "SELECT * FROM roster WHERE `Position`<='4' AND `Terminated`='0' ORDER BY Position";
    $q1rz=mysql_query($q1) or die(mysql_error());
    
    while($row1 = mysql_fetch_array($q1rz)){
    ?>
    
    
    <b><font color="orange" size="3"><? echo $row1['Name']; ?></font></b><br>
    <i><? echo $row1['Title']; ?></i><br>
    Cell: <? echo $row1['CellPhone']; ?> &nbsp &nbsp &nbsp Home: <? echo $row1['HomePhone']; ?><br>
    E-Mail: <a href=mailto:<? echo $row1['Email']; ?>><? echo $row1['Email']; ?></a><br>
    <? echo $row1['Notes']; ?><p>
    
    
    <?
    }
    ?>
    

     

    Now, it will pull out like 5 entries or so. Now, I want to put the output into a table, which I can do. What I don't know how to do is this: They are going to be looking at 5 entries in 'form' form and will be able to change it. But how do I get it to update whatever they changed? Make sense? I mean, it's not like your standard form where you know what the input is going to be. If it's one entry or 5 entries that are displayed I want the power to update them. Make sense?

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.