Jump to content

hikingwithu2

Members
  • Content Count

    45
  • Joined

  • Last visited

Community Reputation

0 Neutral

About hikingwithu2

  • Rank
    Newbie

Contact Methods

  • Website URL
    http://www.wiegand.org

Profile Information

  • Location
    Barranquilla, Colombia
  1. Oh, I just noticed something! The last "else" has no condition, is this the reason why my code didn't work? Because my final "else" had a condition? If true, then do I need to add a final "else" with no condition? (The page is working now without it.) But, what is the correct thing to do?
  2. Thanks, that does indeed fix it, but I don't understand why it is happening. After all, the form of the process is (from this W3 site) - if (condition) { code to be executed if this condition is true; } elseif (condition) { code to be executed if first condition is false and this condition is true; } else { code to be executed if all conditions are false; } Which is how my code was written, using the third condition as only "else".
  3. I am writing a CRUD and this is a test page to combine 3 separate files into one page. If I comment out the final "else" section entirely the first "if" section and the "else if" section work fine, no errors. After I remove the comment marks for the final "else" section I get this error: PHP Parse error: syntax error, unexpected '?>' in /public_html/crud/test.php on line 139 (<- the line 139 the error points to is the final php closing tag before the closing body tag) It should be obvious, simple, but I can't find any reason why it is throwing out that error and breaking the page (it is just a blank white page). I'm sure somebody can scan through the code and see what I'm missing. Thanks. <!DOCTYPE html> <html> <head> <?php require_once "../HeaderStuff.php"; require_once "../connection.php"; ?> <style> table { width: 100%; } th {background-color: #f1f1c1;} .margin {margin-top: 4em;} </style> </head> <body style="background-color:<?php echo $bgColor; ?>"> <?php $choice = $_GET['choice']; $id = $_GET['id']; if ($choice == 'blogsEdit') { ?> <table class="w3-table-all"> <thead> <tr> <th class="textBig w3-padding-32 w3-left-align">Website Administration - Edit Blog</th> </tr> </thead> </table> <?php $sql = "SELECT id, cat, Fdate, title, para1, story, pic, picAlt FROM blogs WHERE id = $id"; $result = mysqli_query($link, $sql); if (mysqli_num_rows($result) > 0) { // output data of each row while($row = mysqli_fetch_assoc($result)) { // Display each field of the records. $id=$row['id']; // the blog id $cat=$row['cat']; // the blog category $Fdate=$row['Fdate']; // the blog date $title=$row['title']; // short title of the blog $para1=$row['para1']; // the introduction paragraph $story=$row['story']; // the rest of the blog after the intro paragraph $pic=$row['pic']; // picture for the blog $picAlt=$row['picAlt']; // alt text for the picture ?> <fieldset> <form action="blogsUpdate.php" method="post"> <table class="w3-table-all"> <tr> <th>Category:</th> <td><?php echo $cat; ?></td> </tr> <tr> <th>Blog Date:</th> <td><input type="text" name="Fdate" value="<?php echo $Fdate; ?>" /></td> </tr> <tr> <th>Blog Title</th> <td><input type="text" name="title" size="150" value="<?php echo $title; ?>" /></td> </tr> <tr> <th>Intro Paragraph</th> <td><textarea name="para1" id="para1" cols="150" rows="5"><?php echo $para1; ?></textarea></td> </tr> <tr> <th>Story</th> <td><textarea name="story" id="story" cols="150" rows="10"><?php echo $story; ?></textarea></td> </tr> <tr> <th>Picture File Name</th> <td><input type="text" name="pic" size="50" value="<?php echo $pic; ?>" /></td> </tr> <tr> <th>Picture Alt Text</th> <td><input type="text" size="150" name="picAlt" value="<?php echo $picAlt; ?>" /></td> </tr> <tr> <input type="hidden" name="id" value="<?php echo $id; ?>" /> <td colspan="2"><button type="submit">Save Changes</button></td> </tr> </table> </form> </fieldset> <?php } } else { echo "0 results"; } } else if ($choice == 'lessonsEdit') { ?> <table class="w3-table-all"> <thead> <tr> <th class="textBig w3-padding-32 w3-left-align">Website Administration - Edit Lesson</th> </tr> </thead> </table> <?php $sql = "SELECT id, cat, Fname FROM blogs WHERE id = $id"; $result = mysqli_query($link, $sql); if (mysqli_num_rows($result) > 0) { // output data of each row while($row = mysqli_fetch_assoc($result)) { // Display each field of the records. $id=$row['id']; // the lesson id $cat=$row['cat']; // the lesson category $Fname=$row['Fname']; // the file name ?> <fieldset> <form action="lessonsUpdate.php" method="post"> <table class="w3-table-all"> <tr> <th>Category:</th> <td><?php echo $cat; ?></td> </tr> <tr> <th>File Name:</th> <td><input type="text" name="Fname" value="<?php echo $Fname; ?>" /></td> </tr> <tr> <input type="hidden" name="id" value="<?php echo $id; ?>" /> <td colspan="2"><button type="submit">Save Changes</button></td> </tr> </table> </form> </fieldset> <?php } } else { echo "0 results"; } } else ($choice == 'writsEdit') { ?> <table class="w3-table-all"> <thead> <tr> <th class="textBig w3-padding-32 w3-left-align">Website Administration - Edit Writing</th> </tr> </thead> </table> <?php $sql = "SELECT id, cat, title, story FROM blogs WHERE id = $id"; $result = mysqli_query($link, $sql); if (mysqli_num_rows($result) > 0) { // output data of each row while($row = mysqli_fetch_assoc($result)) { // Display each field of the records. $id=$row['id']; // the writing id $cat=$row['cat']; // the category $title=$row['title']; // title of the writing $story=$row['story']; // the poem or story ?> <fieldset> <form action="writsUpdate.php" method="post"> <table class="w3-table-all"> <tr> <th>ID:</th> <td><?php echo $id; ?></td> </tr> <tr> <th>Category:</th> <td><?php echo $cat; ?></td> </tr> <tr> <th>Title</th> <td><input type="text" name="title" size="150" value="<?php echo $title; ?>" /></td> </tr> <tr> <th>Story</th> <td><textarea name="story" id="story" cols="150" rows="10"><?php echo $story; ?></textarea></td> </tr> <tr> <input type="hidden" name="id" value="<?php echo $id; ?>" /> <td colspan="2"><button type="submit">Save Changes</button></td> </tr> </table> </form> </fieldset> <?php } } else { echo "0 results"; } } ?> </body> </html>
  4. I found my problem, and hopefully others searching these forums can learn from my mistake - I removed a level of div that was overriding a previously called div. The second div had display:block which was overriding the previous div which has display:table-cell. The two divs now match each others heights as described in the docs.
  5. Ok, I think I have something on this topic - the two cells do indeed always match sizes as long as the cell to the right is the same or small height as the cell on the left. If the right-cell is taller, the left-cell will not adjust and match the height. It appears to work only with the right-cell matching the left-cell. I haven't done any extra testing yet, but that appears to be what is happening. What I have done today is put some text in the left-cell and an image in the right-cell, if the image is taller than what the left-cell wants for the its own text, then the right-cell (image cell) grows taller. If I put more text in the left-cell it will grow automatically of course, but the right-cell will also grow to match it. Edit: I might be wrong afterall, as I just tried it with two div of text and no matter how much text is in either, the two side by side divs will not align to the same height. It's very strange, as I use side by side boxes in many places and they all align perfectly no matter what is in each of them. More testing... More testing shows the right-cell follows the left-cell for height. As the left-cell changes height the right-cell will follow, but it does not work in the reverse. More testing...
  6. FYI - (no help needed, this is a demonstration) - I'm in the process of developing a site for non-English speakers to learn conversational English (not grammar, as is the case with most English learning websites). While writing one of the pages I was experimenting with the radius and accordion and got some cool and unexpected results, you can see what I mean by looking at the page here - http://wiegand.org/ChipsEnglishHelp/a1-u0-intro.php Maybe some of you have already come across this, I don't know, but this is the first time I've seen this effect, anywhere. The accordion code I found on a website, then I added a radius of 10% to the <li> in the .css. Here's the code - /* * Author: Michael Raffaele <michael@mraffaele.com> * Date: 25th October 2011 * Info: http://www.mraffaele.com/blog/2011/10/25/css-accordion-no-javascript/ */ /* Shared for all accordion types */ .accordion { font-family:Verdana,Geneva,sans-serif; margin:0 auto; width:35em; padding:.5em; background:inherit; } .accordion ul { list-style:none; margin:0; padding:0; } .accordion li { margin:0; padding:0; border-radius: 10% } .accordion [type=radio], .accordion [type=checkbox] { display:none; } .accordion label { display:block; font-size:.8em; text-align:center; line-height:.8em; background:inherit; border:0; color:#542437; font-weight:600; cursor:pointer; text-transform:uppercase; -webkit-transition: all .2s ease-out; -moz-transition: all .2s ease-out; } .accordion ul li label:hover, .accordion [type=radio]:checked ~ label, .accordion [type=checkbox]:checked ~ label { background:#C02942; text-align: center; color:#FFF; } .accordion .content { padding:0 .5em; overflow:hidden; border:0; -webkit-transition: all .5s ease-out; -moz-transition: all .5s ease-out; } .accordion p { color:#333; margin:0 0 .5em; } .accordion h3 { color:#542437; padding:0; margin:.5em 0; } /* Vertical */ .vertical ul li { overflow:hidden; margin:0 0 .05em; } .vertical ul li label { padding:.5em; text-align: center; } .vertical [type=radio]:checked ~ label, .vertical [type=checkbox]:checked ~ label { border-bottom:0; } .vertical ul li label:hover { border:0; } .vertical ul li .content { height:0; border-top:0; text-align: center; } .vertical [type=radio]:checked ~ label ~ .content, .vertical [type=checkbox]:checked ~ label ~ .content { height:20em; border:0; }
  7. Here's the reference - https://www.w3schools.com/w3css/w3css_layout.asp Layout Cells Adjust to Equal Height Side-by-side w3-cell elements will also automatically self-adjust to equal height: I'm still having this problem, though it is not 100%, it might be more like 10%.
  8. Here's the reference - https://www.w3schools.com/w3css/w3css_layout.asp Layout Cells Adjust to Equal Height Side-by-side w3-cell elements will also automatically self-adjust to equal height: I'm still having this problem, though it is not 100%, it might be more like 10%.
  9. I got it working, here's the code: <style> .menubar { width: 100%; clear:both; padding:.5em; box-shadow:0 .07em .07em black; background-color:yellow; border-left:.43em solid orange; border-radius:.57em; } .h1-bar a { color:#000; background-color:yellow; box-shadow:0 .15em .15em black, 0 0 1.8em orange, 0 0 .36em indigo; border-radius:.57em; padding:.5em; margin-top:.5em; } .bar { width:100%; overflow:hidden; display:inline-block; } .btnMenu { float:left; background: orange; padding:.15em; border-radius:.57em; margin-right:.75em; -webkit-transition: background-color .5s ease-out; -moz-transition: background-color .5s ease-out; -o-transition: background-color .5s ease-out; transition: background-color .5s ease-out; } .btnMenu:hover { background-color: red; cursor: pointer; } .btnMenuReversed { float:left; background: pink; padding:.75em; margin:.5em; border-radius:.57em; -webkit-transition: background-color .5s ease-out; -moz-transition: background-color .5s ease-out; -o-transition: background-color .5s ease-out; transition: background-color .5s ease-out; } .btnMenuReversed:hover { background-color: green; cursor: pointer; } </style> <div class="bar menubar"> <div class="h1-bar"> <div class="btnMenu"><span class="btnMenuReversed"><a href="index.html">Home</a></span></div> <div class="btnMenu"><span class="btnMenuReversed"><a href="courses.html">Courses</a></span></div> <div class="btnMenu"><span class="btnMenuReversed"><a href="why.html">Why English?</a></span></div> <div class="btnMenu"><span class="btnMenuReversed"><a href="contact.html">Contact</a></span></div> </div> </div>
  10. I have a menubar that works great in Opera 49.0 but in Firefox 57.0.2(64bit) and IE11 there are no links, therefore it doesn't work at all. If I move the link urls outside the buttons they work as expected, but the buttons are completely messed up. What could possibly be the problem? The html looks like this: <div class="w3-bar menubar "> <div class="h1-bar"> <button class="btnMenu"><a href="index.html">Home</a></button> <button class="btnMenu"><a href="courses.html">Courses</a></button> <button class="btnMenu"><a href="why.html">Why English?</a></button> <button class="btnMenu"><a href="contact.html">Contact</a></button> </div> </div> And the .css looks like this: .menubar { width: 100%; clear:both; padding:1em; box-shadow:0 .07em .07em black; background-color:yellow; border-left:.43em solid orange; border-radius:.57em; } .h1-bar a { color:#000; background-color:yellow; box-shadow:0 .15em .15em black, 0 0 1.8em orange, 0 0 .36em indigo; border-radius:.57em; padding:.5em; margin-top:1em; }
  11. hmm, yeah, those do not sound familiar at all, but for some reason, in the back of my mind, I just seem to recall seeing something about those two divs being automatically drawn to the same size without the use of tables. I don't like using tables for layout, they are for data.
  12. When making two side-by-side divs with different amounts of text in them, and coloring the background, the two divs are of different heights. Now, I can use the style/height to set a height in pixels for the two divs, but I seem to recall seeing something in the w3schools site that showed how to make the two divs automatically the same height without setting the height in pixels. Or am I mistaken?
  13. Yes I do, and that particular section will not change as it is for images/graphics that need a white background, rather than making all the images/graphics transparent. So for this site that is acceptable.
  14. Exactly, that's what I have settled on - names like - section1 (which is dark blue), section2 (which is dark green, etc, and BtnSection1 (for a contrasting button for the dark blue section. I've followed this same pattern for other subsections. It's been a lot of trial and error experimenting, but it's all coming together now. This whole process is to change an old website to a more modern site, changing not just styles but also formatting. I hope to be done with it next year (I'm working on it alone, between my private language students).
  15. I have gotten it working as I had hoped - In my .css file I have done this: /* the dark blue section */ .section1 { content:""; float:left; width: 66.6666%; display:table; clear:both; padding:0.01em 16px; border-radius:8px; color:#fff !important; background-color:#000066 !important; border-left:6px solid #0000ff !important; } /* right-side column for images and graphics */ .whiteSection { float:left; width: 33.3333%; padding:0 8px; text-align:center!important; background-color:#fff!important; } So, what does this do for me? This is what would be needed in every page of the site if using the w3-css properties directly - <div class="w3-row"> <div class="w3-container w3-twothird w3-safety-yellow w3-text-black w3-leftbar w3-border-orange w3-round-large"> <p>stuff</p> </div> <div class="w3-container w3-third w3-white w3-center"> <img src="../images/image.png" alt="image.png" width="250" height="117" /> </div> </div> Now all of that is changed to this: <div class="w3-row"> <div class="section1"> <p>stuff</p> </div> <div class="whiteSection"> <img src="../images/image.png" alt="image.png" width="250" height="117" /> </div> </div> Obviously a huge simplification of all the webpages and much easier to manage and update later. Comments and suggestions welcome.
×
×
  • Create New...