Jump to content

Wickham

Advanced Member
  • Posts

    1,114
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by Wickham

  1. ...but lots of people are using HTML5 as it gives some extra benefits. When you use a validator you just get a warning Using experimental feature: HTML5 Conformance Checker. The validator checked your document with an experimental feature: HTML5 Conformance Checker. This feature has been made available for your convenience, but be aware that it may be unreliable, or not perfectly up to date with the latest development of some cutting-edge technologies. If you find any issues with this feature, please report them. Thank you. Personally, I am using HTML5 but I don't use all the new features and I check on several browsers and hand-held devices using Opera Mobile Emulator http://www.opera.com/developer/mobile-emulator which gives lots of mobile devices to check.
  2. Here's another tutorial showing how to set up php.ini file to send emails from localhost on your computer: http://roshanbh.com.np/2007/12/sending-e-mail-from-localhost-in-php-in-windows-environment.html
  3. This w3.org page http://www.w3.org/html/wg/drafts/html/master/Overview.html uses par 8.1.1 uses capitals but I cannot believe it make any difference to use lower case, apart from raising a validation error.
  4. Will this Safari tutorial help? http://developer.apple.com/library/safari/#documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/AudioandVideoTagBasics/AudioandVideoTagBasics.html You have used <source src="serendipity_libtheora_008.ogv" type="video/ogg" /> <source src="serendipity.m4v" type="video/mp4" /> I use .oggv type="video.ogg" and I haven't noticed a problem, but I haven't used .m4v I just use .mp4 but you may be correct. This page is for Safari http://caniuse.com/#feat=mpeg4 This page is for all browsers http://caniuse.com/#feat=video so check each sub-feature link below the schedule
  5. w3schools is a reasonably good tutorial for beginners but remember that even tutorials can be wrong. Look at the mistakes listed on http://w3fools.com/ w3schools was completely updated a year or two ago and has now got rid of the HTML 4.01 and XHTML 1.0 doctypes and uses the HTML5 doctype, but has kept the old HTML coding separate from the new HTML5 stuff. http://www.w3schools.com/html/default.asp You need to be aware that some elements were removed in HTML5, see http://www.w3schools.com/html/html5_new_elements.asp near the page bottom, and HTML5 is still in beta (officially hasn't been released yet but only minor changes are expected in future). The most important removed tags which many people still use (but shouldn't although browsers still seem to process them) are center, font, frame, frameset, noframes.
  6. In addition to Eric's five solutions, here's another which is slightly different. In your solution at present each li tag is 16.666% wide so the space between Moloney Family and Media is smaller than between Media and Gallery. Item 4 on http://www.wickham43.net/dropdownmenus.php has no width for the li tags or for the whole ul tag so the li tags only use what they need and the spacing is equal padding. It does mean that the menu doesn't fill the whole width in a large window, but it always centers even if text in li tags is different. It uses two 50% positions, one positive and the other negative. If the window isn't wide enough, the right end tab(s) drop down, like your's do now.
  7. Essentially, you just have to add the mail function last, after the submission to your database. See if you can work it out from here to suit your code:- $result=MYSQL_QUERY("INSERT INTO villagehall (id, day, month, year,date,starttime, endtime, club, room, who, phone, email, message, book)". "VALUES ('NULL', '$day', '$month', '$year', '$date', '$starttime', '$endtime', '$club1', '$room' , '$who1', '$phone1' , '$email1' , '$message1', '$book')")or die( "<p><span style=\"color: red;\">Unable to select table</span></p>"); mysql_close(); mail( $email, "Village Hall booking", "$day/$month/$year $starttime to $endtime\r\n$room $book\r\n$club\r\n\r\n$replymsg", "From: $admin" ); header( "Location: $thankyouurl" ); } ?> The above is just part of the code. It's old mysql; I have updated my page to mysqli which is recommended now, but the code is a little bit more complicated as more than one parameter is often needed.
  8. Wickham

    Css Vs. Css3

    This is the official CSS3 page from w3.org http://www.w3.org/TR/css3-selectors/ which has changes from CSS2 in item 1.3
  9. Start with simple code to test out what each position can do. Forget static, hardly ever actually stated as it's the default. Position: relative and position: absolute are essential to learn and position: fixed is more or less self-explanatory except that it doesn't work in old IE browsers. See http://www.wickham43.net/divboxes.php and http://www.wickham43.net/threecolumns.php or Google div boxes. The float principle is often hard for beginners especially the need to clear floats. See http://www.wickham43.net/firefoxbackground.php because floats can affect the way a background does (or doesn't) show and the way following divs can move up beside or over floated divs if you don't clear the float. Flash is on the way out because it's bad for SEO (search engine optimisation).
  10. There could be three reasons: 1. Did you upload the images into the host server using the same directories and subdirectories as your folder and subfolder framework & names? 2. A conflict between lower and upper case. Your browser and WordPress may be case insensitive but your host's server is case sensitive so image.JPG is not the same as image.jpg so make sure the image filename and the img code in the HTML are the same case. 3. A path problem. Are the img codes relative like <img src="image.jpg" alt="Image 1" /> or absolute like <img src="http://www.your-domain.com/image.jpg" alt="Image 1" /> ? Absolute codes should work but relative codes are better so check the path, ie is it related to the C:\ drive on your computer (wrong) or are the paths to the folders and subfolders correct? The text you are seeing may be the alt text which displays if the image is unavailable.
  11. Wickham

    Replacing tables

    I hadn't noticed before, but you have a block element h3 inside an inline element "a" which is not allowed and could therefore get a different display from different browsers as they try to guess what the correct display should be. I gave the .column text-align: center; and made it bigger with a background to see what the effect was: .column { text-align: center; float: left; background: pink; padding: 10px; width: 500px; height: 300px; } h3 { font-weight: bold; background: lime; } p { background: yellow; } You could have no block elements at all, then the "a" tag and the img would both be centered by the text-align: center in .column and separated by a line break: <div class="column"> <a href="gallery1.htm" style="font-weight: bold;">Gallery #1</a> <br> <a href="gallery1.htm"><img src="images/square_j.jpg" width=300 height=200></a> </div> but the "a" tag has no top and bottom margin or padding so it's close to the img (it's bad practice to create more space by adding more <br> tags). OR You should have the "a" tag inside the h3 tag, then the img could be inside an "a" tag inside a p tag and then you have two block elements inside the container .column. <div class="column"> <h3><a href="gallery1.htm">Gallery #1</a></h3> <p><a href="gallery1.htm"><img src="images/square_j.jpg" width=300 height=200></a></p> </div> It appears that the text-align: center in .column is inherited by the text and img BUT notice that the h3 and p tag colors are full width although the "a" and img tags inside are centered. OR You could have the "a" tag inside the h3 tag, then the img could be inside only an "a" tag (just give the "a" tag a display: block; for and no p tag) and then you still have two block elements inside the container .column. <div class="column"> <h3><a href="gallery1.htm">Gallery #1</a></h3> <a style="display: block;" href="gallery1.htm"><img src="images/square_j.jpg" width=300 height=200></a> </div>
  12. Wickham

    Replacing tables

    It was badly worded by me. Div h3 and p are all block elements but I meant to refer to what you put inside them. You can have a few words of text then an img tag then a few more words of text and they will all be on the same line, running together, inside a block element, unless the img has a display: block style which breaks the inline state. <p>A few words <img src="image.jpg" alt="Image 1" /> a few more words.</p> See http://www.htmlhelp.com/reference/html40/inline.html and http://www.htmlhelp.com/reference/html40/block.html So if you want a line of text then an image on a separate line or with margins and padding you have to end the text in a block element and start an img tag with display: block; <h3>Heading text</h3> <img style="display: block; width: 300px; height: 200px; border: 2px solid black;" src="image.jpg" alt="Image 1" /> <p>Text in a p tag</p> The image can therefore be used in two ways.
  13. Wickham

    Replacing tables

    It's worth remembering that the img tag is an inline element tag and treated like a text unless it has display: block in the style. If the h3 and img tags were both inside a div which had text-align: center it would align both the text and the img.
  14. I wouldn't be surprised if the control panel menu just creates a 301 redirect automatically. You just don't see the 301 code or know that it's happening.
  15. Why has #msg got padding-top: 300px? Record added will move up if you delete that.
  16. What happens if you add clear; both; to #msg (and possibly to #updateForm as well)? #msg { clear: both; float:right; padding-right:250px; padding-top:300px; font-size:15px; font-weight:bold; color:#C00; } #updateForm { clear: both; float:right; margin-top:120px; } You also need a doctype at the very top of the page, above the <html> tag. <!doctype html>
  17. That article is mainly about HTML emails but mine are just plain text where I wanted line breaks. I've seen some topics that say that Outlook does have problems with \r\n and now I've added a double \r\n\r\n to the last position before the $message $body=$day . "/" . $month . "/" . $year . ", " . $starttime . " to " . $endtime . "\r\n" . $room . ", " . $book . "\r\n" . $club . "\r\n" . $who . ", " . $email . " " . $phone . "\r\n\r\n" . $message; which adds a full line space instead of a line break. It adds a full line space in Outlook and webmail so at least it's consistent and in my case it's quite a good idea to have a full line space between short data like an email address and a message. What is strange is that other articles say that Outlook has a problem with all \r\n but in my case they all worked except in the one place when following an email address
  18. There's more information here http://www.webconfs.com/how-to-redirect-a-webpage.php at Redirect old domain to new domain Check that Godaddy uses a Linux server and check any Godaddy help pages. Also http://www.squidoo.com/301#module156239770 which says "Secondly, when you 301 redirect an old domain to a new one, be aware that you'll have to keep paying for the annual domain renewal and server account of the old domain name." http://blog.hubspot.com/blog/tabid/6307/bid/7430/What-is-a-301-Redirect-and-Why-Should-You-Care.aspx
  19. A 301 redirect in .htaccess will quite simply redirect someone who tries to open the old site in a browser to the new site. The old site can be deleted, edited or left as it is, no one will see it. You will have to copy over any files that are still valid to a new root directory for the new domain or if you just want the whole of the old site to remain unchanged, change the host server to point to the new domain and all the old files will stay as they are. I'm asuming that both domain names are hosted on the same server. You don't need a .htaccess file for every file, just one for the whole hosting service.
  20. The \r\n works in all cases except at the end of teh second mail function so I don't think using only \n will cure it. As a further experiment I added another \r\n like this:- $body=$day . "/" . $month . "/" . $year . ", " . $starttime . " to " . $endtime . "\r\n" . $room . ", " . $book . "\r\n" . $club . "\r\n" . $who . ", " . $phone . ", " . $email . "\r\n" . $message . "\r\n" . $who; mail( $email, "Village Hall booking", "$day/$month/$year $starttime to $endtime\r\n$room $book\r\n$club\r\n$replymsg", "From: $admin" ); mail( $admin, "Village Hall booking", $body, "From: $admin" ); so there are five \r\n in the second mail. The first three work as before but the last two don't work so I have day/month/year, starttime endtime room, book club who, phone, email message who when it should show day/month/year, starttime endtime room, book club who, phone, email message who I'm beginning to think that there is a limit of three \r\n and more than that don't work. Edit: after testing again I've discovered that the \r\n after $email doesn't work. I substituted $who for $email just before $message $body=$day . "/" . $month . "/" . $year . ", " . $starttime . " to " . $endtime . "\r\n" . $room . ", " . $book . "\r\n" . $club . "\r\n" . $who . ", " . $phone . ", " . $who . "\r\n" . $message; and all four \r\n worked. I also tested four \r\n in the first mail function which does not have $email and all four worked there, so for some reason $email blocks the operation of \r\n. I thought that swapping $phone and $email $body=$day . "/" . $month . "/" . $year . ", " . $starttime . " to " . $endtime . "\r\n" . $room . ", " . $book . "\r\n" . $club . "\r\n" . $who . ", " . $email . " " . $phone . "\r\n" . $message; so that there was a space after $email between $email and $phone and \r\n after $phone before $message would enable the last \r\n to work, but it didn't. However, as I said before, leaving out $email altogether does enable the fourth \r\n to work. SUCCESS EDIT 2: I've just used my online webmail system to view an email instead of using Outlook and all four \r\n worked properly, showing the message on a separate line as I wanted. So Outlook, for some reason, ignores \r\n when it occurs after an email address.
  21. width="45%" or width="45px" are teh old method of styling and perhaps HTML5 is objecting to a deprecated method. You should use a class or id and separate styling in the styesheet for the width. Img tags used on their own need display: block for width, height, margin etc. to work. .imgright { width: 45%; display: block; border: 5px ridge; background: #655A46; padding: 2px; margin-left: 2%; float: right; } Delete width="45%" in the markup. Does that work?
  22. For addresses there is the address tag http://htmlhelp.com/reference/html40/block.html http://www.w3schools.com/tags/tag_address.asp but you have to style it how you want as it has deafult styling which you may not like. Most browsers render it in italic unless you change that.
  23. I have an online form which sends two emails, one to the user and one to the admin. mail( $email, "Village Hall booking", "$club\r\n$room $book\r\n$day/$month/$year $starttime to $endtime\r\n$replymsg", "From: $admin" ); mail( $admin, "Village Hall booking", "$club\r\n$room $book\r\n$day/$month/$year $starttime to $endtime\r\n$who $phone $email\r\n$message", "From: $admin" ); The \r\n works in all cases except one which is the last in the second email between $email and $message but it does work between all the others including the $endtime and $replymessage in the first email. So in an email received by admin the last line is text from $who $phone $email $message all on one line. The only difference is that $email is an input type="text" whereas the $message is a textarea but I don't see why that should make a difference. The variables don't extract from a database, they are straight from the form post after remove_headers and stripslashes. Any ideas why this is? What's interesting is that I've just changed the order to mail( $email, "Village Hall booking", "$day/$month/$year $starttime to $endtime\r\n$room $book\r\n$club\r\n$replymsg", "From: $admin" ); mail( $admin, "Village Hall booking", "$day/$month/$year $starttime to $endtime\r\n$room $book\r\n$club\r\n$who $phone $message\r\n$email", "From: $admin" ); for the second email and the first three \r\n work to give a new line but there is no line break between $message and $email so $who $phone $message and $email are all on the same line, so it's definitely the last \r\n that doesn't want to work whatever variable comes after it. It's very odd. I decided to wrap up all the body part of the email in one variable $body for the second email $body=$day . "/" . $month . "/" . $year . ", " . $starttime . " to " . $endtime . "\r\n" . $room . ", " . $book . "\r\n" . $club . "\r\n" . $who . ", " . $phone . ", " . $email . "\r\n" . $message; mail( $email, "Village Hall booking", "$day/$month/$year $starttime to $endtime\r\n$room $book\r\n$club\r\n$replymsg", "From: $admin" ); mail( $admin, "Village Hall booking", $body, "From: $admin" ); and as before all the \r\n worked except the very last one between $email and $message (a few commas were added but that's irrelevant).
  24. Thanks, that's something I would never have guessed. Editing for all three fields works now, but the New Entry page doesn't add a new id and data. I changed $stmt->bind_param("ss", $room, $who, $book); by adding an extra s but it doesn't work. When everything is set up for id plus 2 fields like your tutorial, the New Record page does create a new record, but adding the extra s in the above code didn't work for me for id + 3 fields. EDIT Got it. I had to add an extra ,? in if ($stmt = $mysqli->prepare("INSERT villagehallbooking2 (room, who, book) VALUES (?, ?, ?)")) Now to add the other 12 fields (lots of s and ,? needed). I had set up a booking form in 2007 with MySQL but it wasn't used because I had to enter the database directly to edit and delete, but now with the edit and delete via a web page someone else can do it easily.
  25. I've been setting up a booking system and I used Ben's topic "basic-php-system-view-edit-add-delete-records-with-mysqli/" http://www.killersites.com/community/index.php?/topic/3064-basic-php-system-view-edit-add-delete-records-with-mysqli/ I've tested with Wampserver and online with three fields (id plus two like Ben's tutorial) and it works, but if I add in an extra field to the database, view.php file and the edit file, I get these warnings "Warning: mysqli_stmt::bind_param() [mysqli-stmt.bind-param]: Number of elements in type definition string doesn't match number of bind variables in /home/broadcha/public_html/edit-new-records.php on line 88 Warning: mysqli_stmt::execute() [mysqli-stmt.execute]: (HY000/2031): No data supplied for parameters in prepared statement in /home/broadcha/public_html/edit-new-records.php on line 89 Warning: Cannot modify header information - headers already sent by (output started at /home/broadcha/public_html/edit-new-records.php:88) in /home/broadcha/public_html/edit-new-records.php on line 99" The edit file that works with id plus two fields is <?php /* Allows the user to both create new records and edit existing records */ // connect to the database include("connect-db.php"); // creates the new/edit record form // since this form is used multiple times in this file, I have made it a function that is easily reusable function renderForm($room = '', $who ='', $error = '', $id = '') { ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title> <?php if ($id != '') { echo "Edit Record"; } else { echo "New Record"; } ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> </head> <body> <h1><?php if ($id != '') { echo "Edit Record"; } else { echo "New Record"; } ?></h1> <?php if ($error != '') { echo "<div style='padding:4px; border:1px solid red; color:red'>" . $error . "</div>"; } ?> <form action="" method="post"> <div> <?php if ($id != '') { ?> <input type="hidden" name="id" value="<?php echo $id; ?>" /> <p>ID: <?php echo $id; ?></p> <?php } ?> <strong>Room: *</strong> <input type="text" name="room" value="<?php echo $room; ?>"/><br/> <strong>Name: *</strong> <input type="text" name="who" value="<?php echo $who; ?>"/> <p>* required</p> <input type="submit" name="submit" value="Submit" /> </div> </form> </body> </html> <?php } /* EDIT RECORD */ // if the 'id' variable is set in the URL, we know that we need to edit a record if (isset($_GET['id'])) { // if the form's submit button is clicked, we need to process the form if (isset($_POST['submit'])) { // make sure the 'id' in the URL is valid if (is_numeric($_POST['id'])) { // get variables from the URL/form $id = $_POST['id']; $room = htmlentities($_POST['room'], ENT_QUOTES); $who = htmlentities($_POST['who'], ENT_QUOTES); // check that firstname and lastname are both not empty if ($room == '' || $who == '') { // if they are empty, show an error message and display the form $error = 'ERROR: Please fill in all required fields!'; renderForm($room, $who, $error, $id); } else { // if everything is fine, update the record in the database if ($stmt = $mysqli->prepare("UPDATE villagehallbooking SET room = ?, who = ? WHERE id=?")) { $stmt->bind_param("ssi", $room, $who, $id); $stmt->execute(); $stmt->close(); } // show an error message if the query has an error else { echo "ERROR: could not prepare SQL statement."; } // redirect the user once the form is updated header("Location: villagehall-with-form2admin.php"); } } // if the 'id' variable is not valid, show an error message else { echo "Error!"; } } // if the form hasn't been submitted yet, get the info from the database and show the form else { // make sure the 'id' value is valid if (is_numeric($_GET['id']) && $_GET['id'] > 0) { // get 'id' from URL $id = $_GET['id']; // get the recod from the database if($stmt = $mysqli->prepare("SELECT * FROM villagehallbooking WHERE id=?")) { $stmt->bind_param("i", $id); $stmt->execute(); $stmt->bind_result($id, $room, $who ); $stmt->fetch(); // show the form renderForm($room, $who, NULL, $id); $stmt->close(); } // show an error if the query has an error else { echo "Error: could not prepare SQL statement"; } } // if the 'id' value is not valid, redirect the user back to the view.php page else { header("Location: villagehall-with-form2admin.php"); } } } /* NEW RECORD */ // if the 'id' variable is not set in the URL, we must be creating a new record else { // if the form's submit button is clicked, we need to process the form if (isset($_POST['submit'])) { // get the form data $room = htmlentities($_POST['room'], ENT_QUOTES); $who = htmlentities($_POST['who'], ENT_QUOTES); $who = htmlentities($_POST['who'], ENT_QUOTES); // check that room and club are both not empty if ($room == '' || $who == '') { // if they are empty, show an error message and display the form $error = 'ERROR: Please fill in all required fields!'; renderForm($room, $who, $error); } else { // insert the new record into the database if ($stmt = $mysqli->prepare("INSERT villagehallbooking (room, who) VALUES (?, ?)")) { $stmt->bind_param("ss", $room, $who); $stmt->execute(); $stmt->close(); } // show an error if the query has an error else { echo "ERROR: Could not prepare SQL statement."; } // redirec the user header("Location: villagehall-with-form2admin.php"); } } // if the form hasn't been submitted yet, show the form else { renderForm(); } } // close the mysqli connection $mysqli->close(); ?> which is exactly like Ben's except for field names and table name changes but the file with an extra field that doesn't work is <?php /* Allows the user to both create new records and edit existing records */ error_reporting(E_ALL); // connect to the database include("connect-db.php"); // creates the new/edit record form // since this form is used multiple times in this file, I have made it a function that is easily reusable function renderForm($room = '', $who ='', $book ='', $error = '', $id = '') { ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title> <?php if ($id != '') { echo "Edit Record"; } else { echo "New Record"; } ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> </head> <body> <h1><?php if ($id != '') { echo "Edit Record"; } else { echo "New Record"; } ?></h1> <?php if ($error != '') { echo "<div style='padding:4px; border:1px solid red; color:red'>" . $error . "</div>"; } ?> <form action="" method="post"> <div> <?php if ($id != '') { ?> <input type="hidden" name="id" value="<?php echo $id; ?>" /> <p>ID: <?php echo $id; ?></p> <?php } ?> <strong>Room: *</strong> <input type="text" name="room" value="<?php echo $room; ?>"/><br/> <strong>Name: *</strong> <input type="text" name="who" value="<?php echo $who; ?>"/><br/> <strong>Status: *</strong> <input type="text" name="book" value="<?php echo $book; ?>"/> <p>* required</p> <input type="submit" name="submit" value="Submit" /> </div> </form> </body> </html> <?php } /* EDIT RECORD */ // if the 'id' variable is set in the URL, we know that we need to edit a record if (isset($_GET['id'])) { // if the form's submit button is clicked, we need to process the form if (isset($_POST['submit'])) { // make sure the 'id' in the URL is valid if (is_numeric($_POST['id'])) { // get variables from the URL/form $id = $_POST['id']; $room = htmlentities($_POST['room'], ENT_QUOTES); $who = htmlentities($_POST['who'], ENT_QUOTES); $book = htmlentities($_POST['book'], ENT_QUOTES); // check that firstname and lastname are both not empty if ($room == '' || $who == '' || $book == '') { // if they are empty, show an error message and display the form $error = 'ERROR: Please fill in all required fields!'; renderForm($room, $who, $book, $error, $id); } else { // if everything is fine, update the record in the database if ($stmt = $mysqli->prepare("UPDATE villagehallbooking SET room = ?, who = ?, book = ? WHERE id=?")) { $stmt->bind_param("ssi", $room, $who, $book, $id); $stmt->execute(); $stmt->close(); } // show an error message if the query has an error else { echo "ERROR: could not prepare SQL statement."; } // redirect the user once the form is updated header("Location: villagehall-with-form2admin.php"); } } // if the 'id' variable is not valid, show an error message else { echo "Error!"; } } // if the form hasn't been submitted yet, get the info from the database and show the form else { // make sure the 'id' value is valid if (is_numeric($_GET['id']) && $_GET['id'] > 0) { // get 'id' from URL $id = $_GET['id']; // get the recod from the database if($stmt = $mysqli->prepare("SELECT * FROM villagehallbooking WHERE id=?")) { $stmt->bind_param("i", $id); $stmt->execute(); $stmt->bind_result($id, $room, $who, $book ); $stmt->fetch(); // show the form renderForm($room, $who, $book, NULL, $id); $stmt->close(); } // show an error if the query has an error else { echo "Error: could not prepare SQL statement"; } } // if the 'id' value is not valid, redirect the user back to the view.php page else { header("Location: villagehall-with-form2admin.php"); } } } /* NEW RECORD */ // if the 'id' variable is not set in the URL, we must be creating a new record else { // if the form's submit button is clicked, we need to process the form if (isset($_POST['submit'])) { // get the form data $room = htmlentities($_POST['room'], ENT_QUOTES); $who = htmlentities($_POST['who'], ENT_QUOTES); $book = htmlentities($_POST['book'], ENT_QUOTES); // check that room and club are both not empty if ($room == '' || $who == '' || $book == '') { // if they are empty, show an error message and display the form $error = 'ERROR: Please fill in all required fields!'; renderForm($room, $who, $book, $error); } else { // insert the new record into the database if ($stmt = $mysqli->prepare("INSERT villagehallbooking (room, who, book) VALUES (?, ?)")) { $stmt->bind_param("ss", $room, $who, $book); $stmt->execute(); $stmt->close(); } // show an error if the query has an error else { echo "ERROR: Could not prepare SQL statement."; } // redirec the user header("Location: villagehall-with-form2admin.php"); } } // if the form hasn't been submitted yet, show the form else { renderForm(); } } // close the mysqli connection $mysqli->close(); ?> which seems to stall at $stmt->bind_param("ssi", $room, $who, $book, $id); or just before. It processes the error message if I leave a field blank in the edit box but fails just after that. All I've done is add a field to the database, edited the view file for the extra column (shows the column OK) and added the extra variable into the Edit file. The Edit page shows the data ready to edit, but fails to make the change. Refreshing the database and view file make no difference (they update automatically with the file that works). The New entry box fails the same way. My wampserver just goes staight to the Location page (which shows no change) without showing errors but online I get the errors above. The last warning re headers should go away if the first two can be cured. Any ideas?
×
×
  • Create New...