Jump to content

88f615f6

New Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by 88f615f6

  1. Hi, The following code is what I want in that it creates a menu and I can select and display a table row. I still need to use that selection to update the "lastused". I really appreciate your help. <!DOCTYPE><html><head><title>email menu</title></head> <body><center> <form name="form" method="post" action=""> <?php $con=mysqli_connect("localhost","root","cookie","homedb"); //============== check connection if(mysqli_errno($con)) {echo "Can't Connect to mySQL:".mysqli_connect_error();} else {echo "Connected to mySQL</br>";} //This creates the drop down box echo "<select name= 'target'>"; echo '<option value="">'.'--- Select email account ---'.'</option>'; $query = mysqli_query($con,"SELECT target FROM emailtbl"); $query_display = mysqli_query($con,"SELECT * FROM emailtbl"); while($row=mysqli_fetch_array($query)) {echo "<option value='". $row['target']."'>".$row['target'] .'</option>';} echo '</select>'; ?> <input type="submit" name="submit" value="Submit"/><!-- update "lastused" using selected "target"--> </form></body></html> <!DOCTYPE><html><head><title>email menu</title></head> <body><center> <?php $con=mysqli_connect("localhost","root","cookie","homedb"); if(mysqli_errno($con)) {echo "Can't Connect to mySQL:".mysqli_connect_error();} if(isset($_POST['target'])) { $name = $_POST['target']; $fetch="SELECT target,username,password,emailused,lastused, purpose, saved FROM emailtbl WHERE target = '".$name."'"; $result = mysqli_query($con,$fetch); if(!$result) {echo "Error:".(mysqli_error($con));} $lastused = "CURDATE()"; // update "lastused" using selected "target" //display the table echo '<table border="1">'.'<tr>'.'<td bgcolor="#ccffff align="center">'. 'Email menu'. '</td>'.'</tr>'; echo '<tr>'.'<td>'.'<table border="1">'.'<tr>'.'<td bgcolor="#ccffff align="center">'.'target'.'</td>'.'<td bgcolor="#ccffff align="center">'.'username'.'</td>'.'<td bgcolor="#ccffff align="center">'.'password'.'</td>'.'<td bgcolor="#ccffff align="center">'.'emailused'.'</td>'.'<td bgcolor="#ccffff align="center">'.'lastused'.'</td>'.'<td bgcolor="#ccffff align="center">'.'purpose'. '</td>'.'<td bgcolor="#ccffff align="center">'. 'saved' .'</td>'.'</tr>'; while($data=mysqli_fetch_row($result)) {echo ("<tr><td>$data[0]</td><td>$data[1]</td><td>$data[2]</td><td>$data[3]</td><td>$data[4]</td><td>$data[5]</td><td>$data[6]</td></tr>");} echo '</table>'.'</td>'.'</tr>'.'</table>'; } ?> </body></html>
  2. I'm trying to use js function to: upon entering "paidamt" change the "amtdue", "prevbal",auto-insert the current date(datepaid), change"pd", and increment the "checkno". I had this working at one time but memory precludes the use of the onblur. The following code displays all values for selected record from database and only updates "paidamt". Any help? echo "<tr> <td><input type='text' readonly size=15 name='acctno' value='" . $row['acctno'] . "' ></td> <td><input type='text' readonly size=25 name='bname' value='" . $row['bname'] . "'></td> <td><input type='text' readonly size=25 name='purpose' value='" . $row['purpose'] . "'></td> <td><input type='text' size=7 id='paidamt' name='paidamt' value='" . $row['paidamt'] ."' onBlur='calculate_paid(this)'></td> <td><input type='text' size=5 name='amtdue' value='" . $row['amtdue'] . "' ></td> <td><input type='text' size=5 name='prevbal' value='" . $row['prevbal'] . "' ></td> <td><input type='text' size=5 name='datepaid' value='" . $row['datepaid'] . "' ></td> <td><input type='text' size=5 name='pd' value='" . $row['pd'] . "' ></td> <td><input type='text' size=5 name='checkno' value='" . $row['checkno'] . "' ></td> </tr>"; function $_(IDS) { return document.getElementById(IDS); } function calculate_paid() { var recur = parseInt(document.getElementById("recur").value; var pd = parseInt(document.getElementById("pd").value; var shipamt = parseFloat(document.getElementById("shipamt").value; var paidamt = parseFloat(document.getElementById("paidamt").value; var prevbal = parseFloat(document.getElementById("prevbal").value; var amtdue = parseFloat(document.getElementById("amtdue").value; var checkno = parseInt(document.getElementById("checkno").value; var datepaid = parseFloat(document.getElementById("datepaid").value; var dateNow = new Date(); var dayNow = dateNow.getDate(); var datePaid = (dateNow.getMonth()+1)+"/"+dateNow.getDate()+"/"+dateNow.getFullYear(); datepaid.value = datePaid; prevbal.value = parseFloat(amtdue.value) + parseFloat(shipamt.value) - parseFloat(paidamt.value); amtdue.value = parseFloat(amtdue.value) + parseFloat(shipamt.value) - parseFloat(paidamt.value); checkno.value = parseInt(checkno.value) + "1"; if(recur.value=="N") {prevbal.value= amtdue.value;} if(prevbal.value=="0.00") {pd="P";} if(amtdue.value=="0.00") {pd="P";}
  3. Hi, Someone please tell me how to resolve this issue ? following is error derived from my code which then follows: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" ><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="en" /> <meta name="viewport" content="width=device-width; height=device-height; initial-scale=1.0" /> <link type="text/css" rel="stylesheet" href="print.css" media="print" /> <title> Accounts Payable Demo </title> </head><body> <table class="accountsPayable"> <caption> Accounts Payable Report </caption><thead> <tr> <th>recur?</th> <th>acct#</th> <th>creditor</th> <th>purpose</th> <th>due</th> <th>late</th> <th>due</th> </tr> </thead><tfoot> <tr> <td colspan="3">', date('m/d/y'), '</td> <td colspan="4" class="page"></td> </tr> </tfoot><tbody> <?php $totalDue = 0; // ********************************************** foreach ($rows as $row) { $totalDue += $row['amtdue']; echo ' <tr> <td>', $row['status'], '</td> <td>', $row['acctno'], '</td> <td>', $row['bname'], '</td> <td>', $row['purpose'], '</td> <td>', $row['duedate'], '</td> <td class="currency">', ($row['dayslate'] > 120 ? 'pastdue' : $row['dayslate']), '</td> <td class="currency">', number_format($row['amtdue'], 2, '.', ''), '</td> </tr>'; } echo ' <tr class="grandTotal"> <th scope="row" colspan="6">Grand Total:</th> <td class="currency">', number_format($totalDue, 2, '.', ''), '</td> </tr>'; ?> </tbody> </table> </body></html>
×
×
  • 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.