Jump to content

wantabe2

Members
  • Posts

    68
  • Joined

  • Last visited

Everything posted by wantabe2

  1. Short answer is I DO NOT know how to limit the input of those characters in the code as well as I DO NOT want to know as I am not a programmer nor want to be or pretend to be one. I do work in IT in a totally different realm. The only reason I have been task to do this, is because I have time to do it. With that said, I hope I answered your questions, in hoping someone else will respond instead of getting the third degree with more questions as to how or why I do what I do!!
  2. update super set `name` = REPLACE(`name`, ',' , ' ') I have the following code that removes the comma in a MySQL database column & replaces it with a blank. In the above example, the database is named super & the column is named name. This code works great but currently I'm running the script each day & changing it to also remove periods, question marks, etc. Is there a way I can edit the above code that will not only find & replace the , with a blank space, but edit it so it will find the periods, commas, question mark, exclamation mark, etc all in one run? Please help as I am currently editing the above code to numerous other things to find & replace daily. Thank
  3. I got it working thanks to all your help & thanks again!!! I do have one question though..in this line of code: $sql = "SELECT names FROM clerk_names ORDER BY RAND() LIMIT 1"; The limit 1 at the end of the line, what does that do? If I change it to 2 or 3 what does that do? I have 10 names in the database to randomly choose from, is there any way to change this number so the same name will not be chosen twice without starting at the begining of the DB again? Or in other words, any way to change it so a name can not be chosen twice without all names have already been chosen?
  4. Oh, never mind..I got it LOL I'll give it a try thanks
  5. Where would I add: <?php echo $var ?> in the code I've tried adding it several places & get random errors.
  6. If I try that code I get the below error: Parse error: syntax error, unexpected T_SL in C:\wamp\www\gflow\officer_query\assign_test.php on line 204 on line 204 the code is: $tableRow =<<<TABLE thanks
  7. still don't get it.... why isn't it returning the sql results in the form value?
  8. ok, I think I've just about got it with all of your help & thanks! Below is my code: <?php $mysqli = new mysqli('localhost', 'myusername', 'mypassword', 'flow'); $sql = "SELECT names FROM clerk_names ORDER BY RAND() LIMIT 1"; $res = $mysqli->query($sql); $row = $res->fetch_row(); $randomName = $row[0]; $res->free(); ?> <td><b>Assign To:</b> <br><input type="text" name="clerk_names" size="15" maxlength="30" value="<?=$randomName?>" /><br /> </td> In the mysql databse the databse name is flow. The table the names are listed in is named clerk_names & the only fields in thei table is names & clerk_id. When I put the above code in a form & display it in a browser, in the Assign To: field the value shows <?=$randomName?> instead of the result from the query...have I mistyped something? Thanks again for any help or assistance provided.
  9. for the value=" " Is there any way for me to randomly insert a name in there each time the form is displayed in a browser? I have a list of 5 names I'd like to randomly be displayed. Is that possible?
  10. I have a phpmyadmin database named FLOW. I have a table in that database named NAMES. I have a form that has the below code in it: <td><b>Assign To:</b> <br><input type="text" name="name" size="15" maxlength="30" value="" /><br /> </td> My question is, how would I edit this code to pull the data from the table listed above for the value?
  11. Ok, I'll do that...thanks...What am I doing wrong here with the settings in PHPMYADMIN? Field = last_used Type = timestamp Length/Value = Default = Current_Timestamp Attributes = Null =
  12. I have some php code that supervisors use to assign work to employees. I've added a field named clerks. There are 10 clerk names in the phpmyadmin database..clerk1, clerk2, clerk3, and so on to clerk10. I need for the clerk names to be automatically added to the clerk field in the form when it is opened..for instance, if the form is opened clerk1 is automatically inserted. And the next time it is opened, clerk2 is inserted until it reaches clerk10 & then starts over by inserting clerk1....is this possible?Like I said, I have a table in the database named clerk_names & the clerk's name is listed in this table. The database name is named flow. Any help will be greatly appreciated. Thanks
  13. I have a form with a field for users to type in the current date. My question is, is there any way for me to have the current date to automatically populate in this field? Here's the code I am using: <tr> <td><b>Date Assigned (YYYY-MM-DD):</b> <br /><input type="text" name="date_assign" size="25" /><br /> </tr> If I could get todays date to automatically pop in this that would be great! Thanks
  14. I added this & it didn't work: if (mail($EmailAddress, $Subject, $Message, $Headers)) mysql_query("UPDATE yourtablename SET active=1 WHERE id = $id"); The email was sent but the active field remained a 0 & was not changed to a 1. Any suggestions?
  15. So I would add mysql_query("UPDATE yourtablename SET active=1 WHERE id = $id"); under if (mail($EmailAddress, $Subject, $Message, $Headers)) if (mail($EmailAddress, $Subject, $Message, $Headers)) mysql_query("UPDATE yourtablename SET active=1 WHERE id = $id"); ?? Thanks
  16. I have this PHP script on my website that pulls some data from my MySQL database & displays it on a form. The user them adds additional items to the form & then clicks submit & all of the information on the form is emailed to a secretary. In the database, I have a field named active & it is either set to 0 or 1. Is it possible to edit this code so when the user clicks the submit button the email still gets sent but in addition it marks the "active" field in teh databae to a 1? <p> <b> <i>To go to the main page <a href="http://mysite/flow/index.html">click here</a>.</b> </i></p> <?php $page_title = 'Edit a Record'; $con = mysql_connect("localhost","uname","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("psrflow", $con); ini_set('display_errors',1); error_reporting(E_ALL); if ( (isset($_GET['id'])) && (is_numeric($_GET['id'])) ) { $id = $_GET['id']; } elseif ( (isset($_POST['id'])) && (is_numeric($_POST['id'])) ) { $id = $_POST['id']; } else { echo '<h1 id="mainhead">Page Error</h1> <p class="error">This page has been accessed in error.</p><p><br /><br /></p>'; include ('./includes/footer.html'); exit(); } if (isset($_POST['submitted'])) { $errors = array(); if (empty($_POST['pnumber'])) { $errors[] = 'You forgot to enter your pnumber number. If there is no pnumber # you can enter 0000'; } else { $pt = $_POST['pnumber']; } if (empty($_POST['customer_fname'])) { $errors[] = 'You forgot to enter the customers first name.'; } else { $fn = $_POST['customer_fname']; } if (empty($_POST['customer_lname'])) { $errors[] = 'You forgot to enter the customers last name.'; } else { $ln = $_POST['customer_lname']; } if (empty($_POST['employee1'])) { $errors[] = 'You forgot to enter a employee1.'; } else { $off = $_POST['employee1']; } if (empty($_POST['custnom'])) { $errors[] = 'You forgot to enter a custnom number.'; } else { $dkt = $_POST['custnom']; } if (empty($_POST['customer_mname'])) { $errors[] = 'You forgot to enter a middle name. If none, please enter NONE'; } else { $mn = $_POST['customer_mname']; } if (empty($_POST['district'])) { $errors[] = 'You forgot to enter a district'; } else { $dist = $_POST['district']; } if (empty($_POST['dft_no'])) { $errors[] = 'You forgot to enter a unlucky number'; } else { $dft_no = $_POST['dft_no']; } if (empty($errors)) { if (mysql_affected_rows() == 1) echo '<p><b><center>This information has been submitted successfully! </p><p>An email containing all this information has been sent to your secretary to update pnumber for this customer.</b></p></center>'; $EmailAddress = 'theemail@yahoo.com'; $Message = "Someone has submitted the information below.\n \n \nemployee1 Notes : ${_REQUEST['notes']}\n\npnumber No : ${_REQUEST['pnumber']} \nemployee1 : ${_REQUEST['employee1']} \ncustomer Name : ${_REQUEST['customer_fname']} ${_REQUEST['customer_mname']} ${_REQUEST['customer_lname']} \nDistrict (State if not ED/TN) : ${_REQUEST['district']} \ncustnom No : ${_REQUEST['custnom']} \nunlucky No : ${_REQUEST['dft_no']} \n \nSent Date : ${_REQUEST['sent_date']} \nAdjudication Date : ${_REQUEST['adjud_date']} \nOffense Level : ${_REQUEST['tol']} \nHistory Points : ${_REQUEST['chp']} \ncustomer Type : ${_REQUEST['too']} \nTest Waiver : ${_REQUEST['dtwav']} \ntheboss Name : ${_REQUEST['theboss_name']} \nSent Type : ${_REQUEST['sent_type']} \nTime : ${_REQUEST['pt']} ${_REQUEST['time_mdy']} \nInside Start Date : ${_REQUEST['psd']} \nTSR Time : ${_REQUEST['tsr_time']} ${_REQUEST['tsr_mdy']} \nWatch Time : ${_REQUEST['prob_time']} ${_REQUEST['pro_mdy']} \nConditional Release : ${_REQUEST['cond_rel']} \nSpecial Assessment : ${_REQUEST['spec_asse']} \nWhy Is Interest Waived : ${_REQUEST['faiw']} ${_REQUEST['int_waved']} \nIs Interest Waived : ${_REQUEST['raiw']} ${_REQUEST['intr_waved']} \n\nClosing Date : ${_REQUEST['close_date']} \nDisposition : ${_REQUEST['disposition']} "; $Subject = "ItHas Been Submitted"; $Headers = "From: PODDS@tnep.uscourts.gov \n"; if (mail($EmailAddress, $Subject, $Message, $Headers)) echo '<p><b><center>This information has been submitted successfully!</center>'; exit(); } else { echo '<h1 id="mainhead">Error!</h1> <p class="error">The following error(s) occurred:<br />'; foreach ($errors as $msg) { echo " - $msg<br />\n"; } echo '</p><p><b>Please try again. You must have forgot to enter something. If you continue to get this error call IT.</b></p><p><br /></p>'; } } $query = "SELECT pnumber, customer_fname, customer_lname, status, employee1, sent_date, custnom, customer_mname, district, dft_no, jud_off_name, assgn_date FROM psrinfo WHERE fid = " . $_REQUEST['id']; $result = @mysql_query ($query); if (mysql_num_rows($result) == 1) { $row = mysql_fetch_array ($result, MYSQL_NUM); ?> <?php echo '<form action="p2.php" method="post"> <h2> <center>pnumber Sentence Date Form. After submitting this information, your secretary will be notified. <center>(P-2)</h2></center></h2> <table width="95%" border="1"> <tr> <td><b>pnumber No:</b> <br><input type="text" name="pnumber" size="15" maxlength="30" value="'.$row[0].'" /><br> </td> <td><b></b> <br><name="" value="" /><br> </td> <td><b>employee1: </b><br><input type="text" name="employee1" size="15" maxlength="30" value="'.$row[4].'" /><br></td> </tr> <tr> <td><b>First Name:</b> <br><input type="text" name="customer_fname" size="15" maxlength="30" value="'.$row[1].'" /><br /> </td> <td><b>Middle Name:</b> <br><input type="text" name="customer_mname" size="15" maxlength="30" value="'.$row[7].'" /><br /> </td> <td><b>Last Name (Corporation/Partnership):</b> <br><input type="text" name="customer_lname" size="25" maxlength="30" value="'.$row[2].'" /><br /> </td> </tr> <td><b>District (State if not ED/TN): <select name="district"> <option value="ED/TN">ED/TN</option> <option value="AL"> AL</option> <option value="AK"> AK</option> <option value="AS"> AS</option> <option value="AZ"> AZ</option> <option value="AR"> AR</option> </select> </td> </br> <td><b>custnom No:</b> <br><input type="text" name="custnom" size="15" maxlength="30" value="'.$row[6].'" /><br> </td> <td><b>unlucky No:</b><br><input type="text" name="dft_no" size="15" maxlength="30" value="'.$row[9].'" /> <br> </td> </tr> <tr> <td><b>Final Date YYYY-MM-DD:</b><br><input type="text" name="sent_date" size="15" maxlength="30" value="'.$row[5].'" /> <br></td> <td><b>Determination Date:</b><br><input type="text" name="adjud_date" size="15" maxlength="30" value="'.$row[11].'" /> <br></td> <td><b>Total Level (0-50):</b><br><input type="text" name="tol" size="15" maxlength="30" /> <br></td> <td><b>History Points (0-50):</b><br><input type="text" name="chp" size="15" maxlength="30" /> <br></td> </tr> <tr> <td> <b>customer Type:<br> <select name="too"> <option value="N/A">N/A</option> <option value="Juvenile">Juvenile</option> <option value="Career customer">Career customer</option> <option value="Sealed">Sealed</option> </select> </td> <td> <b>Test Waiver:<br> <select name="dtwav"> <option value="No">No</option> <option value="Yes">Yes</option> </select> </td> <td><b>theboss Name:</b> <br><input type="text" name="theboss_name" size="20" maxlength="30" value="'.$row[10].'" /><br> </td> <td> <b>Sent Type:<br> <select name="sent_type"> <option value="Choose One">Choose One</option> <option value="Original">Original</option> <option value="Amended">Amended</option> </select> </td> </tr> <tr> <td><b>Inside Time:</b><br><input type="text" name="pt" size="25" maxlength="30" value="N/A"/> <select name="time_mdy"> <option value="N/A">N/A</option> <option value="Days">Days</option> <option value="Months">Months</option> </select><br></td> <td><b>Start Date:</b><br><input type="text" name="psd" size="25" maxlength="30" value="N/A" /> <br></td> <td><b>TSR Time:</b><br><input type="text" name="tsr_time" size="25" maxlength="30" value="N/A" /> <select name="tsr_mdy"> <option value="N/A">N/A</option> <option value="Months">Months</option> </select><br></td> <td><b>Watch Time:</b><br><input type="text" name="prob_time" size="25" maxlength="30" value="N/A" /> <select name="pro_mdy"> <option value="N/A">N/A</option> <option value="Months">Months</option> <option value="Days">Days</option> </select><br></td></tr> <tr> <td> <b>Release:<br> <select name="cond_rel"> <option value="N/A">N/A</option> <option value="Yes">Yes</option> <option value="No">No</option> </select> </td> <td><b>Assessment:</b><br><input type="text" name="spec_asse" size="25" maxlength="30" value="N/A"/> <br></td> <td><b>Is Interest Waived?</b><br><input type="text" name="faiw" size="25" maxlength="30" value="N/A" /> <select name="int_waved"> <option value="N/A">N/A</option> <option value="Yes">Yes</option> <option value="No">No</option> </select><br></td> <td><b>Why Is Interest Waived?</b><br><input type="text" name="raiw" size="25" maxlength="30" value="N/A" /> <select name="intr_waved"> <option value="N/A">N/A</option> <option value="Yes">Yes</option> <option value="No">No</option> </select><br></td></tr> </tr> <tr> <td><b>Closing Date:</b><br><input type="text" name="close_date" size="25" maxlength="30" value="YYYY-MM-DD" /> <br></td> <td> <b>Disposition:<br> <select name="disposition"> <option value="Choose One">Choose One</option> <option value="Close Courtesy Only">Close Courtesy Only</option> </select> <td> <b>employee1 Notes: </b> <b></b> <textarea name = "notes" rows=3 cols=50>N/A</textarea> </br> </td> </tr> </table> &nbsp&nbsp&nbsp&nbsp <div align="left"> &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<input type="submit" name="submit" value="Submit" /></div></td> <input type="hidden" name="submitted" value="TRUE" /> <input type="hidden" name="id" value="' . $id . '" /> </form>'; } else { echo '<h1 id="mainhead">Page Error</h1> <p class="error">This page has been accessed in error.</p><p><br /><br /></p>'; } mysql_close(); ?>
  17. ok, I thought I had this working but I guess not. Once I click the submit button the email goes but I need to be redirected to a web page named http://myserver/notification_sent.php I edited the line: <form method="post"> to look like <form method="post" action="http://myserver/notification_sent.php"> & I then get redirected to the page I need but the email don't go out. $mailheaders = "From: Reporting System<rps@yahoo.org>"; $destination = array(); if (!empty($_POST['notify_jane'])) $destination[] = 'email1@yahoo.org'; if (!empty($_POST['notify_john'])) $destination[] = 'email2@yahoo.org'; if ($destination) { mail(join(', ', $destination), 'Document Added/Updated', 'This is a test notification', $mailheaders); } ?> <form method="post"> <input type="hidden" name="formsent" value="true" /> <br/> If you do not need to send a notification to someone you can close this window. If you do, choose the name(s) below and click submit. <br/>------------------------------------------------------- <br/>Check this box <input autocomplete="off" type="checkbox" name="notify_jane" value="yes" /> to send <strong>John Doe</strong> a notification. <br/>Check this box <input autocomplete="off" type="checkbox" name="notify_jane" value="yes" /> to send <strong>Jane Doe</strong> a notification. <br> <br> <input type="submit" value="Submit" /> <br/>------------------------------------------------------- </form> <?php
  18. If I put just this code: <?php if (isset($_POST['formsent'])) { $destination = array(); if (!empty($_POST['notify_jane'])) $destination[] = jane@yahoo.com; if (!empty($_POST['notify_john'])) $destination[] = john@yahoo.com; if ($destination) { mail(join(', ', $destination), 'Notification', 'Hey there'); } } else { ?> <form action="<?=$_SERVER['PHP_SELF']?>" method="post"> <input type="hidden" name="formsent" value="true" /> <br/>Check this box <input autocomplete="off" type="checkbox" name="notify_jane" value="yes" /> to send <strong>John Doe</strong> a notification. <br/>Check this box <input autocomplete="off" type="checkbox" name="notify_john" value="yes" /> to send <strong>Jane Doe</strong> a notification. <input type="submit" value="Submit" /> </form> <?php } I still does not work & I get the URL below in the browser...thanks to any help provided. http://myserver/flow/%3C?=$_SERVER['PHP_SELF']?>
  19. I have some other .php scripts that generates email when the submit buttons are clicked & it works.....as far as the join variable...I'm new to php & not that advanced.
  20. The attached code works except the email portion. This code allows a user to upload a file(s) to a network share & has a few check mark boxs for John Doe & Jane Doe. If the box for John or Jane is checked it is suppose to send them an email once submit is pressed but the email does not get sent. Can someone help me out on this? Thanks 17405_.txt
  21. Is there any way to edit this code so the user will get a pop up box if the enter a date other than in the format YYYY-MM-DD for the date_disclo_att field? I have some javascript code on lines 120-129 but it is not working. Can someone help me out? <b> <p> <i> To go to the main page <a href="http://tnep-g-psrflow/flow/index.html">click here</a>.</p> </i> <?php # edit_dqa.php $page_title = 'Edit a Record'; $con = mysql_connect("localhost","username","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("psrflow", $con); ini_set('display_errors',1); error_reporting(E_ALL); if ( (isset($_GET['id'])) && (is_numeric($_GET['id'])) ) { $id = $_GET['id']; } elseif ( (isset($_POST['id'])) && (is_numeric($_POST['id'])) ) { $id = $_POST['id']; } else { // No valid ID, kill the script. echo '<h1 id="mainhead">Page Error</h1> <p class="error">This page has been accessed in error.</p><p><br /><br /></p>'; include ('./includes/footer.html'); exit(); } if (isset($_POST['submitted'])) { $errors = array(); if (empty($_POST['pacts'])) { $errors[] = 'You forgot to enter your PACTS number. If there is no PACTS # you can enter 0000'; } else { $pt = $_POST['pacts']; } if (empty($_POST['fname'])) { $errors[] = 'You forgot to enter the first name.'; } else { $fn = $_POST['fname']; } if (empty($_POST['lname'])) { $errors[] = 'You forgot to enter the last name.'; } else { $ln = $_POST['lname']; } if (empty($_POST['date_sub_crt'])) { $errors[] = 'You forgot to enter a date submitted to office!.'; } else { $crt = $_POST['date_sub_crt']; } if (empty($_POST['date_disclo_att'])) { $errors[] = 'You forgot to enter the supervisor disclosure date!'; } else { $disc = $_POST['date_disclo_att']; } if (empty($errors)) { $query = "UPDATE psrinfo SET pacts='$pt', fname='$fn', lname='$ln', date_sub_crt='$crt', date_disclo_att='$disc' WHERE fid=$id"; $result = @mysql_query ($query); // Run the query. $EmailAddress = 'email@yahoo.com'; $Message = "A clerk has entered a 'Date Submitted to supervisor or office'. Please enter/edit this information in PACTS.\n \n PACTS No : ${_REQUEST['pacts']}\n First Name : ${_REQUEST['fname']} \n Last Name : ${_REQUEST['lname']} \n Date Submitted to office : ${_REQUEST['date_sub_crt']} \n Date Dislosed to supervisor : ${_REQUEST['date_disclo_att']} "; $Subject = "A Clerk has Edited a Record."; $Headers = "From: PODDS@yahoo.com \n"; if (mail($EmailAddress, $Subject, $Message, $Headers)) { echo "<p><center><h2>My Office</h2></center></p>"; echo "<p><h3><center>Eastern District</center></h3></p>"; echo "<center>An email has been sent to your supervisor for approval and "; } else { echo "This system is not working properly. Please contact IT so they can fix it."; } $url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']); if ((substr($url, -1) == '/') OR (substr($url, -1) == '//')) { $url = substr ($url, 0, -1); } $url ='/flow/index.html'; header("Location: $url"); exit(); } else { // Report the errors. echo '<h1 id="mainhead">Error!</h1> <p class="error">The following error(s) occurred:<br />'; foreach ($errors as $msg) { // Print each error. echo " - $msg<br />\n"; } echo '</p><p>Please try again.</p><p><br /></p>'; } } $query = "SELECT pacts, fname, lname, date_sub_crt, date_disclo_att, date_disclo_att FROM psrinfo WHERE fid = " . $_REQUEST['id']; $result = @mysql_query ($query); // Run the query. if (mysql_num_rows($result) == 1) { $row = mysql_fetch_array ($result, MYSQL_NUM); ?> <script type="text/javascript"> function checkme() { if(!document.forms[0].date_disclo_att.value.match(/\d{4}-\d{1,2}-\d{1,2}/)) { alert("ATTENTION: Please enter your start date in the format yyyy-mm-dd."); document.forms[0].date_disclo_att.focus(); return(false); } else {return true} </script> <?php echo '<form action="clerk_edit.php" method="post"> <fieldset><legend><h2> You are editing a record! After submitting this form, your DQA will be notified of the change via email.</h2></legend> <b>PACTS No:</b> <br><input type="text" name="pacts" size="15" maxlength="30" value="'.$row[0].'" /><br> <b>First Name:</b> <br><input type="text" name="fname" size="15" maxlength="30" value="'.$row[1].'" /><br /> <b>Last Name:</b> <br><input type="text" name="lname" size="15" maxlength="30" value="'.$row[2].'" /><br /> <b>Submitted to office: </b><br><input type="text" name="date_sub_crt" size="15" maxlength="30" value="'.$row[3].'" /> <br> <b>Submitted to supervisor: </b><br><input type="text" name="date_disclo_att" size="15" maxlength="30" value="'.$row[4].'" /> <br> </fieldset> <div align="left"><input type="submit" name="submit" value="Submit" /></div> <input type="hidden" name="submitted" value="TRUE" /> <input type="hidden" name="id" value="' . $id . '" /> </form>'; } else { // Not a valid user ID. echo '<h1 id="mainhead">Page Error</h1> <p class="error">This page has been accessed in error.</p><p><br /><br /></p>'; } mysql_close(); // Close the database connection. ?>
  22. Here's the code that checks to make sure something is entered & not left blank.....can I do something similair to this code to make sure the date is enetered in the YYYY-MM-DD format? if (empty($_POST['date_disclo_att'])) { $errors[] = 'You forgot to enter the date!'; } else { $disc = $_POST['date_disclo_att']; }
  23. That would be neat....I have no clue how to use a date picker...could I see some sample code?
×
×
  • 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.