Jump to content

kevinritt

Members
  • Posts

    108
  • Joined

  • Last visited

    Never

Everything posted by kevinritt

  1. Thanks Voip03, That tutorial will get me started but my form is quite extensive: name, address, state, zip, phone, business, etc and will have input, radio, drop down fields. Creating the form is not a problem. The things I'm weak on are validation (best practices, security), inserting into database (I can do basic but I want to make sure I do it correctly) and I need a way to access the info once it's submitted. I'd need to send an email to admin whenever the form is submitted. Gravity Forms is great but it's the customization that's the problem. I know it's a lot - thanks for any help
  2. I would like to take info from a membership form that I created for my website and store it in a database. Can anyone recommend a tutorial that would guide me through the basics of doing this? The membership form has about 25 fields that I'd like to store in a db and referrence as needed. This is a wordpress site and i tried Gravity Forms but I need to have more flexibilty in the form creation. (I know this forum is for code already written, so admin can you move to apporpriate forum?) Thanks
  3. thanks. I've been looking at the osdate. I Will take a look at some of the others as well. I'll write my impressions of the one I use. Thanks for the help
  4. Thanks joel24. I did Google. I was checking to see if anyone had any experience with a particular script and could give some input. I want to use something that is coded correctly and is secure. I'm not sure how to verify if a script is adequate or not. I'm a little cautious when the demo send you to a 404 page http://date.tufat.com/2.1.3/index.php
  5. Does anyone know of an open source dating software script that is available or a tutorial that would help with the coding of one? (wasn't sure if this was the right forum to post this question)
  6. Thanks - good catch Typical rookie mistake
  7. didn't mean to remove that - I added $query ="INSERT INTO detention (date,comments) VALUES ('$date','$comments')"; $result = mysql_query($query) or trigger_error(mysql_error(),E_USER_ERROR); I get this error: Fatal error: No database selected in C:\wamp\www\Detention\index.php on line 10 Line 10 is the result variable $result I'm sure that it's something simple that I'm missing but I don't see it Here's the dbconn file: <? /* -- Configure the Variables Below --*/ $dbhost = 'localhost'; $dbuser = 'user'; $dbpasswd = 'pw'; $database = 'pickering'; /* Database Stuff, do not modify below this line */ $connection = mysql_connect("$dbhost","$dbuser","$dbpasswd") or die ("Couldn't connect to server."); $db = mysql_select_db("$database", $connection) or die("Couldn't select database."); ?>
  8. Still working on it but missing something. Here's what I changed: $connection = mysql_connect("$dbhost","$dbuser","$dbpasswd") or die ("Couldn't connect to server."); $db = mysql_select_db("$database", $connection) or die("Couldn't select database."); Here's the query: $query ="INSERT INTO detention (date,comments) VALUES ('$date','$comments')"; $result = mysql_query($query) or die ('Data not entered');
  9. I keep getting a 'No database selected' error when I try to enter data. Here's the code for the dbconn.php file in the connections folder: <?php $hostname_dbconn = "localhost"; $database_dbconn = "pickering"; $username_dbconn = "name"; $password_dbconn = "password"; $dbconn = mysql_pconnect($hostname_dbconn, $username_dbconn, $password_dbconn) or trigger_error(mysql_error(),E_USER_ERROR); ?> and here's the query: <?php require_once('connections/dbconn.php'); if ($_POST['submit']) { // data from form $date = $_POST['date']; $comments = $_POST['comments']; # THIS CODE TELL MYSQL TO INSERT THE DATA FROM THE FORM INTO YOUR MYSQL TABLE $query ="INSERT INTO detention (date,comments) VALUES ('$date','$comments')"; $result = mysql_query($query) or die ("Sql Error" .mysql_error()); echo 'data entered' <br /> <meta http-equiv="refresh" content="2; url=./index.php">'; } else { ?> rest of page ... I tried changing the path to the dbconn from this connections/dbconn.php to this /connections/dbconn.php still cannot get it to work
  10. At the risk of sounding like an idiot - does anyone know of a good blog tutorial? What I am trying to do is track daily notes that I write about students in a school. I want to be able to add/edit entries based on the students' names. So let's say on Oct 2: John W, Lisa F, and Jeff B were entered as an entry for the day. 2 months from now if I want to look up entries that mention Lisa F, I'd like everyone that has her name to show. I though something like a blog would work best but I'm open to suggestions. I'm not programmer but I want to do this on my own. Any help is appreciated
  11. still not working Here's the current page: http://saugustv.org/index.php?page=contact and here's the page with the call to the database and the text editor: http://saugustv.org/indexLiveTest.php?page=2 They use the same CSS but as you can see they don't look the same. Any help would be appreciated - I'm clueless at this point
  12. Would this: echo $row->content; be changed to: echo stripslashes($row->content);
  13. Hi, I'm not sure if this is a PHP issue or TinyMCE. I have content that is saved in a database. It gets called using this code: <?php $page = (isset($_GET['page'])) ? $_GET['page'] : "1"; $sql = "SELECT content FROM pages WHERE id='$page'"; $result = $conn -> query($sql) or die(mysqli_error()); if($result) { $row = $result->fetch_object(); echo $row->content; } ?> The problem is when the code is out put on the site. I save the html like this: <tr> <td class="header">Name</td> <td class="header">Title</td> <td class="header">Email</td> </tr> but it ends up looking like this: <tr> <td class=\"header\">Name</td> <td class=\"header\">Title</td> <td class=\"header\">Email</td> </tr> Futhermore, it gets processed like this in TinyMCE: <tr> <td class="\"header\"">Name</td> <td class="\"header\"">Title</td> <td class="\"header\"">Email</td> </tr> Because of this the CSS classes and IDs do not work. Is there something I can do that would remove the extra characters? Thanks
  14. three days later - it's fixed. Thank you very much. I don't recall having to add the connection variable in with the $_POST variables before. Why does that need to be included if the $conn variable was already defined?
  15. I get this now: Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in C:\wamp\www\saugustv_test\update.php on line 4 Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given in C:\wamp\www\saugustv_test\update.php on line 5 Warning: mysql_query() [function.mysql-query]: Access denied for user 'ODBC'@'localhost' (using password: NO) in C:\wamp\www\saugustv_test\update.php on line 6 Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in C:\wamp\www\saugustv_test\update.php on line 6 Warning: mysqli::query() [mysqli.query]: Empty query in C:\wamp\www\saugustv_test\update.php on line 7 Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\wamp\www\saugustv_test\update.php on line 7
  16. It did not work correctly before I put the mysqli_real_escape_string() in there. Here's the dbconn.php: $conn = new MySQLi("localhost", "root", "", "suagustv") or die (mysqli_error()); there is no password on my localhost for my home pc. I can update content in PHPMyAdmin and it will show correctly. But if I try to edit using TinyMCE - it doesn't save it to the db. All the content is stored in the db
  17. I've been struggling with this one for a couple days. I have a text editor installed for my client to update his site. The problem is is that when a change is made it doesn't save in the db. There's a connection because the content is being pulled from the db. Here's what I've got for code for the admin page: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link href="./css/saugustv2.css" rel="stylesheet" type="text/css" /> <!-- CSS layout was created by Rayzur http://www.rayswoodworks.com/css-demos.html --> <title>Saugus TV</title> <script type="text/javascript" src="editor/jscripts/tiny_mce/tiny_mce.js"></script> <script type="text/javascript"> tinyMCE.init({ // General options mode : "textareas", theme : "advanced", height: "600", plugins : "safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager", // Theme options theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect", theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : true, // Example content CSS (should be your site CSS) content_css : "css/example.css", // Drop lists for link/image/media/template dialogs template_external_list_url : "js/template_list.js", external_link_list_url : "js/link_list.js", external_image_list_url : "js/image_list.js", media_external_list_url : "js/media_list.js", // Replace values for the template plugin template_replace_values : { username : "Some User", staffid : "991234" } }); </script> </head> <body> <div id="minHeight"></div><!--Opera and IE8 min-height fix--> <div id="wrapper"> <div id="header"> <img class="logo" src="http://saugustv.org/images/logo2.jpg" width="779" height="155" /> </div> <div id="container"> <div id="left-nav"> <div id="menu1"> <h3>Pages</h3> <ul> <?php require("connections/dbconn.php"); $sql = "SELECT id, name FROM nav"; $result = $conn -> query($sql) or die(mysqli_error()); if($result) { while($row = $result->fetch_object()) { echo "<li><a href='admin.php?page={$row->id}'>{$row->name}</a></li>"; } } ?> </ul> </div></div> <div id="content"> <?php if(isset ($_GET['message'])){ echo '<font color="red"><strong>You have successfully updated your page </strong></font>'; } $page = (isset($_GET['page'])) ? $_GET['page'] : "1"; $sql = "SELECT * FROM pages WHERE id='$page'"; $result = $conn->query($sql) or die(mysqli_error()); if($result) { $row = $result->fetch_object(); echo '<form method="post" action="update.php">'; echo '<input type="hidden" name="id" value="'.$row->id.'" />'; echo '<textarea name="content">'; echo $row->content; echo '</textarea>'; echo '<input type="submit" name="editContent" value="Update page" />'; echo '</form>'; } ?> </div> </div><!--end container--> </div><!--end wrapper--> <div id="footer"> 1 PEARCE MEMORIAL DRIVE • SAUGUS, MA 01906<br />PHONE - 781.231.2883 • FAX - 781.233.3433 </div> </body> </html> and here's the update page: <?php if (isset ($_POST['editContent'])) { require ("connections/dbconn.php"); $content = mysqli_real_escape_string($_POST['content']); $id = mysqli_real_escape_string($_POST['id']); $sql = "UPDATE pages SET content='$content' WHERE id='$id'"; $result = $conn->query($sql) or die (mysqli_error()); if ($result){ header("location:admin.php?message=1"); } } ?> Any clues - I have no clue what I'm missing here Thanks
  18. the changes will be done by a client. Can you refer me to a tutorial or book for more info on these types of security issues?
  19. Does that mean I have to do more than what I've added?
  20. I have an admin section for my client to edit his pages using TinyMCE. When he edits and saves changes do I need to use mysqli_real_escape_string for my variables like this: <?php if (isset ($_POST['editContent'])) { require ("connections/dbconn.php"); $content = mysqli_real_escape_string($_POST['content']); $id = mysqli_real_escape_string($_POST['id']); $sql = "UPDATE pages SET content='$content' WHERE id='$id'"; $result = $conn->query($sql) or die (mysqli_error()); if ($result){ header("location:admin.php?message=1"); } } ?>
  21. I have web page content (including html, css classes, ids and divs) stored in the database. When I call the page I get strange characters and css is not working. Here's an example of what I get on the page: Basic knowledge of how to use a camcorder to videotape your event. Step by step breakdown on camcorder use, and do�s and don�ts of camera operations. Training will cover the following: Battery and AC use and applications (1 HR.) * Tape loading * Basic Auto settings for immediate recording * Camera movement (do�s and don�ts) o Panning left to right o Zooming in and out * Tripod use, mounting, adjusting for smoothness o Don�t over torque fittings I am using the 'Longtext' type in the database field for the content. Is there a way to get the correct html, css rendered?
  22. alright, alright I get it -'Dumbass of the week award'
  23. yes, dumb oversight. Now I get this error: Notice: Undefined variable: conn in C:\wamp\www\saugustv_test\index.php on line 22 Fatal error: Call to a member function query() on a non-object in C:\wamp\www\saugustv_test\index.php on line 22 Is there somewhere I can see/understand what these errors mean?
×
×
  • 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.