Jump to content

wgoldschagg

Members
  • Posts

    22
  • Joined

  • Last visited

    Never

Everything posted by wgoldschagg

  1. try the following: mysql_connect("localhost","****","****") or die("Couldn't make connection."); mysql_select_db('crimebay'); or die("Couldn't select database."); $naam = $_POST['naam']; $pass = $_POST['pass']; $pass1 = $_POST['pass1']; $email = $_POST['email']; if (strlen($naam) < 1) { die ("Invalid.. name Empty"); } if(strlen($pass) < 1) { die ("Invalid.. password Empty"); } if (strlen($pass1) < 1) { die ("Invalid.. password confirmation Empty"); } if (strlen($email) < 1) { die ("Invalid.. email Empty"); } //the code you want to do if all field are filled;
  2. I've created a registration form where users can request registration documents. The following code works and sends the email. How do I attach a pdf file already on my server to the email? The email code: mail($_POST['Email'] , "Registration Confirmation", $message, "From: \"Absolute Angels Auto-Response\" <donotreply@absoluteangels.co.za>\r\n" . "X-Mailer: PHP/" . phpversion()); Any help would be appreciated.
  3. try setting the form up to require the applicant to enter the details of ther persons to cover for them if these details are not stored in a database. Also I would suggest using tickboxes for your clinical/administrative duties delema. Also use the if else statement when sending the email so the doctor doesnt receive 2 emails when covering both: <?php $email1 = $_POST['ClinicalCoverage']; // but ill have to assign a value="DoctorX@mydomain.com" to your options; $email2 = $_POST['AdminCoverage']; $message = " you must cover the for $_POST['Name']" ; if ( $email1 == $email2 ) { //send email to 1 doctor only; mail("$email1" , "Subject Here", $message, "From: \"Sender Here\" <donotreply@yourdomain.com>\r\n" . "X-Mailer: PHP/" . phpversion()); echo ("Mail Sent"); exit; } else { //send email to clinical doctor; mail("$email1" , "Subject Here", $message, "From: \"Sender Here\" <donotreply@yourdomain.com>\r\n" . "X-Mailer: PHP/" . phpversion()); //send email to administarative doctor; mail("$email2" , "Subject Here", $message, "From: \"Sender Here\" <donotreply@yourdomain.com>\r\n" . "X-Mailer: PHP/" . phpversion()); echo ("Mail Sent"); exit; } ?> this is just a simple idea of what is possible. Give it some thought and you'll figure it out. Good luck
  4. its possible that your config.php isnt set up properly.
  5. HI everyone, I want to write a script in which a user can upload a file to my server. Then the script must list the rename the file and list it's name and a few other details for example: filename = exphpscript.doc listed name = Example PHP Script Now i am not looking for scripts, just some ideas on what methods might work best. In my planning I thought about creating a new table for each upload, but there must be an easier way. Also I need to figure out how to store a valid link to the actual file with the upload. Any input would be apreciated. Thanks
  6. Hi again guys, I am busy trying to write my own blog script, and in case youre wondering i have a pretty good idea of what i want to do, but i dont want to copy code from other scripts. Is it possible to list the names of tables in a database as variables with some mysql query?
  7. Will do in future. Thank you all again. And to the moderator - I have no intention of giving up learning PHP. I was just getting fedup of going through code looking for the error (3 days). It just seemed easier to drop the data from the table and insert the new data after. Anyway I see now what was wrong.
  8. done - YOU ARE A GENUIS - IT WORKS!!!! thanks. Didnt realise that PHP was SO Case Sensative. Thank you all very much for your help. BTW. I Am developing my own website and I am A newbie ( VERY) thats why all the "stupid" errors. thanks again.
  9. For practical puroses I have reverted ALL my code to work with only 2 Database Variables (ClientNo & Name). Note that each section of code is a seperate file. Here is ALL the Code: <------Search Page ( Working Correctly )-------------> <form action="search.php" method="post"> Search By <select name="catag" id="catag"> <option value="Name">Name</option> </select>: <input type="text" name="term" /><br /> <p> <input type="submit" name="submit" value="Submit" /> </form> <---------Displaying Results & Update Button (search.php)----------> <?php include 'src.php'; $term = $_POST['term']; $catag = $_POST['catag']; $sql = mysql_query("select * from client where $catag like '%$term%'"); while ($row = mysql_fetch_array($sql)){ echo "<tr><td style=\"padding:5px;\">Client Number: </td><td>$row[ClientNo] </td><td valign=\"center\" rowspan=\"2\"><form action=\"preupdate.php\" method=\"post\"><input type=\"hidden\" name=\"ClientNo\" value=\"$row[ClientNo]\"><input type=\"submit\" name=\"submit\" value=\"Update Details\" /></form></td></tr>\n"; echo "<tr><td style=\"padding:5px;\">Name: </td><td>$row[Name] </td></tr>\n"; } ?> <----------Displaying the Selected Record in Text Fields exept ClientNo (preupdate.php)--------> <?php include 'src.php'; $id = $_POST['ClientNo']; $result = mysql_query("select * from client where $id = ClientNo"); $row = mysql_fetch_array($result); echo "<form name=\"form2\" method=\"post\" action=\"update.php\" style=\"padding:5px;\">\n"; echo "<tr><td style=\"padding:5px;\">Client Number: </td><td><input type=\"hidden\" name=\"ClientNo\" id=\"ClientNo\" value=\"$row[ClientNo]\">$row[ClientNo]</td></tr>\n"; echo "<tr><td style=\"padding:5px;\">Name: </td><td><input type=\"text\" name=\"Name\" id=\"Name\" value=\"$row[Name]\"></td></tr>\n"; echo "<tr><td colspan=\"2\"><center><input type=\"submit\" name=\"submit2\" value=\"Update Details\"></form></center></td></tr></table>\n"; <----------The Actual Update (update.php)-----------> <?php if ($_POST['submit2'] == 'Update Details') { include 'src.php'; $Name=mysql_real_escape_string(stripslashes($_POST['Name'])); $ClientNo=mysql_real_escape_string(stripslashes($_Post['ClientNo'])); $query = "UPDATE client SET Name='$Name' WHERE ClientNo like '$ClientNo'"; mysql_query($query) or die("Problem with the query: $query<br>" . mysql_error()); header('Location: updated.php'); exit; } Echo ('Error'); exit; ?> All this works exept the actual update - the database still keeps the old data.
  10. It makes no difference - i am going to try a different approach - dropping the data from the table and them inserting the new data. Think its worth a shot.
  11. A Simple Letter Case - will try quick thanks
  12. this may sound silly - but i am going to change WHERE ClientNo='$ClientNo'"; to WHERE ClientNo like '$ClientNo'"; see what it does. the select statement work perfectly with WHERE ClientNo like '$ClientNo'"; to recall the data.
  13. The update code is: <?php if ($_POST['Submit2'] = 'Update Details') { include 'src.php'; $Name=mysql_real_escape_string(stripslashes($_POST['Name'])); $ClientNo=mysql_real_escape_string(stripslashes($_Post['ClientNo'])); $query = "UPDATE client SET Name='$Name' WHERE ClientNo='$ClientNo'"; mysql_query($query) or die("Problem with the query: $query<br>" . mysql_error()); header('Location: updated.php'); exit; } Echo ('Error'); exit; ?> The forms code is: <?php include 'src.php'; $id = $_POST['ClientNo']; $result = mysql_query("select * from client where $id = ClientNo"); $row = mysql_fetch_array($result); echo "<form name=\"form2\" method=\"post\" action=\"update.php\" style=\"padding:5px;\">\n"; echo "<tr><td style=\"padding:5px;\">Client Number: </td><td><input type=\"hidden\" name=\"ClientNo\" id=\"ClientNo\" value=\"$row[ClientNo]\">$row[ClientNo]</td></tr>\n"; echo "<tr><td style=\"padding:5px;\">Name: </td><td><input type=\"text\" name=\"Name\" id=\"Name\" value=\"$row[Name]\"></td></tr>\n"; echo "<tr><td colspan=\"2\"><center><input type=\"submit\" name=\"submit2\" value=\"Update Details\"></center></td></tr>\n"; ?> The form recalls the correct data - and posts the correct data and even goes to updated.php - the script just doesn't do the update - it keeps the old data.
  14. I did what Ken suggested. The script runs now- but it doesnt do the update. Any suggestions?
  15. Trying it now KEN, will let you know what happens. Thanks
  16. HI, I have writtem this update script, but it gives me an error I dont understand as I am relatively new to programming in PHP. Please help. My script: <?php if ($_POST['Submit2'] = 'Update Details') { \\access the database; include 'src.php'; \\Posted Data, In this case the name is Koos.; $Name=$_POST['Name']; $ClientNo=$_Post['ClientNo']; mysql_query("UPDATE client SET Name=$Name WHERE ClientNo='$ClientNo'") or die(mysql_error()); header('Location: updated.php'); exit; } Echo ('Error'); exit; ?> This is the error I receive: Unknown column 'Koos' in 'field list' Please help.
  17. No errors. It goes to update.php, but the the update.php loads a blank page. I think i need a way to display the data recalled in the textfield without actually setting it as a value - I may be wrong. For example: my current code says: echo "<tr><td style=\"padding:5px;\">Name: </td><td><input type=\"text\" name=\"Name\" id=\"Name\" value=\"$row[Name]\"></td></tr>\n"; I think the form posts this value regardless of whether it was edit or not.
  18. This file(preupdate.php) is meant to recall the existing data and display it in a textfield so the user can edit it. The preupdate.php file currently doesn't post any data that has been changed. It Simply posts what it recalled in the first place. my 2nd file (update.php) code looks like this: <?php if ($_POST['Submit'] == 'Update Details') { if (strlen($_POST['IDNo']) < 16) { die ("Invalid I.D. Number. Please enter a valid I.D. Number."); } include 'src.php'; $ClientNo=$_Post['ClientNo']; $Name=$_Post['Name']; $SName=$_Post['SName']; $IDNo=$_Post['IDNo']; $Tel=$_Post['Tel']; $Fax=$_Post['Fax']; $Email=$_Post['Email']; $AgreeDate=$_Post['AgreeDate']; $UI4In=$_Post['UI4In']; $UI4Date=$_Post['UI4DateI']; $UI19In=$_Post['UI19In']; $UI19Date=$_Post['UI19Date']; $UI27In=$_Post['UI27In']; $UI27Date=$_Post['UI27Date']; $UI23In=$_Post['UI23In']; $UI23Date=$_Post['UI23Date']; $UI28In=$_Post['UI28In']; $UI28Date=$_Post['UI28Date']; $CopyID=$_Post['CopyID']; $CopyIDDate=$_Post['CopyIDDate']; $CopyMar=$_Post['CopyMar']; $CopyMarDate=$_Post['CopyMarDate']; $CopyDev=$_Post['CopyDev']; $CopyDevDate=$_Post['CopyDevDate']; mysql_query("UPDATE client set Name = '$Name', SName = '$SName', IDNo = '$IDNo', Tel = '$Tel', Fax = '$Fax', Email = '$Email', AgreeDate = $AgreeDate', UI4In = '$UI4In', UI4Date = '$UI4Date', UI19In = '$UI19In', UI19Date = '$UI19Date', UI27In = '$UI27In', UI27Date = '$UI27Date', UI23In = '$UI23In', UI23Date = '$UI23Date', UI28In = '$UI28In', UI28Date = '$UI28Date', CopyID = '$CopyID', CopyIDDate = '$CopyIDDate', CopyMar = '$CopyMar', CopyMarDate = '$CopyMarDate', CopyDev = '$CopyDev', CopyDevDate = '$CopyDevDate' Where ClientNo = '$ClientNo'") or die(mysql_error()); echo ("Details Successfully Updated"); exit; } ?>
  19. I am trying to create an update database script that loads the existing data and allows the user to update only the fields the user needs to update. I have created 2 files for this purpose (preupdate.php which recalls the existing data and update.php which does the actual apdate). Sofar I can't seem to get the preupdate file to post the changed data - it simply posts whatever it recalled from the database. Please help. Here is my preupdate.php code: <?php include 'src.php'; $id = $_POST['ClientNo']; $result = mysql_query("select * from client where $id like ClientNo"); echo "<Center><table width=\"60%\" border=\"2\" cellpadding=\"2\" cellspacing=\"0\">\n"; echo "<td>\n"; echo "<Center><table width=\"90%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n"; echo "<tr><td colspan=\"2\"><center><b><Font Size=\"6\"><b><u>Update Details</u></b></font></center></td></tr>\n"; $row = mysql_fetch_array($result); echo "<form name=\"form1\" method=\"post\" action=\"update.php\" style=\"padding:5px;\">\n"; echo "<tr><td style=\"padding:5px;\">Client Number: </td><td><input type=\"hidden\" name=\"ClientNo\" id=\"ClientNo\" value=\"$row[ClientNo]\"></td></tr>\n"; echo "<tr><td style=\"padding:5px;\">Name: </td><td><input type=\"text\" name=\"Name\" id=\"Name\" value=\"$row[Name]\"></td></tr>\n"; echo "<tr><td style=\"padding:5px;\">Surname: </td><td><input type=\"text\" name=\"SName\" id=\"SName\" value=\"$row[sName]\"></td></tr>\n"; echo "<tr><td style=\"padding:5px;\">I.D. Number: </td><td><input type=\"text\" name=\"IDNo\" id=\"IDNo\" value=\"$row[iDNo]\"></td></tr>\n"; echo "<tr><td style=\"padding:5px;\">Telephone Number: </td><td><input type=\"text\" name=\"Tel\" id=\"Tel\" value=\"$row[Tel]\"></td></tr>\n"; echo "<tr><td style=\"padding:5px;\">Fax Number: </td><td><input type=\"text\" name=\"Fax\" id=\"Fax\" value=\"$row[Fax]\"></td></tr>\n"; echo "<tr><td style=\"padding:5px;\">Email Adress: </td><td><input type=\"text\" name=\"Email\" id=\"Email\" value=\"$row\"></td></tr>\n"; echo "<tr><td colspan=\"2\"><center><input type=\"submit\" name=\"submit\" value=\"Update Details\"></center></td></tr>\n"; ?>
×
×
  • 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.