Leaderboard


Popular Content

Showing most liked content since 04/19/2017 in all areas

  1. 1 like
    When you're printing each field you can check if the field ID exists in $non_matches, and style the element appropriately. I'm just suggesting that it is more efficient to print everything correct in the first place, versus printing everything then trying to run client-side code to show errors or whatever else.
  2. 1 like
    It really depends on the users browser setting for pdf file type, most browsers by default will use pdf browser plugin specifically for viewing in browser, but if the user changes from default to use browser plugin, to 'always ask' it will show 'download' or 'open with' which could be browser plugin or operating system Adobe reader program. Since it depends on browser settings, you can still use open pdf directly in browser php script for browsers using pdf plugin, then they will presented with alternative to 'save' or 'open with' with an alternative pdf application option. Note: the 'downloaded' part file can be called anything' even original filename, it just renames filename to 'downloaded.pdf' even if original filename was 'test.pdf'.
  3. 1 like
    The form attribute only applies to form control elements. It doesn't exist on elements like <div> or <p>. What kind of element are you referring to when you say "non-form element"? This is regarding the form attribute from the MDN page for the <input> element: When the element is a descendant of a <form> element the form attribute is not needed. If the element is not inside a <form> then the form attribute will indicate which form the element belongs to so that when the form is submitted the element's value is added to the data that is sent. I'm not certain how fieldset elements behave, I would guess that the fieldset's children would belong to the same form that the fieldset belongs to, but it can be easily confirmed with an experiment. Experiments can be done with the form attribute by submitting the form and seeing which values get sent to the server. My guess before doing experiments is that a child of one form that has a form attribute from a different form will be added as a value when either of the two forms are submitted.
  4. 1 like
    You can use scandir() to list files in a directory and generate the HTML for the images. The line breaks exist, but HTML doesn't render line breaks unless you specifically put a <br> element. You can use nl2br() to show line breaks in the text provided by users. You can't choose the size of a file, but you can give a size limit in the file uploader. There are plenty of PHP file upload tutorials, you should look at some of them. The W3Schools tutorial has sections explaining how to limit the file size and file type. You can use str_replace() to change substrings into something else, such as in the following example: <?php $string = str_replace(':)', '<img src="smiley.gif">', $string); ?>
  5. 1 like
    Block elements such as div, h1, p fill the width available to them, any element below them will stack below them, if floated or not. A floated element before a block element/s, will cause the block element to merge within it, and even though the block element still take the full width, the text within them will flow to and around the edges of floated element. #1 If you place img element within the first paragraph, which you can because is a inline element and acts similar to text, It will fall below header h1, the first paragraph text will merge to edge of img element as will the second paragraphs text. For adding a div element to .content class div for extra column, you need to float and set its width to requirements.#2 and #3 <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" id="viewport" content="target-densitydpi=high-dpi,initial-scale=1.0,user-scalable=no" /> <title>Document Title</title> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script> <script type="text/javascript"> </script> <style type="text/css"> * { box-sizing: border-box; } .header, .footer { background-color: grey; color: white; padding: 15px; } .column { float: left; padding: 15px; } .clearfix::after { content: ""; clear: both; display: table; } .menu { width: 25%; } .content { width: 75%; } .menu ul { list-style-type: none; margin: 0; padding: 0; } .menu li { padding: 8px; margin-bottom: 8px; background-color: #33b5e5; color: #ffffff; } .menu li:hover { background-color: #0099cc; } .column.content {float: right;} .column.content > img {float: left; max-width: 25%; margin: 0 8px;} .column.content > div {max-width: 25%;} .column.content > div img {max-width: 100%;} .column.content > div.left {float: left; margin: 0 8px; } .column.content > div.right {float: right; } </style> </head> <body> <div class="clearfix"> <div class="column menu"> <ul> <li>The Flight</li> <li>The City</li> <li>The Island</li> <li>The Food</li> </ul> </div> <div class="column content"><img src="https://www.w3schools.com/w3css/img_lights.jpg" alt=""> <h1>The City #1</h1> <p>Chania is the capital of the Chania region on the island of Crete. The city can be divided in two parts, the old town and the modern city.</p> <p>You will learn more about web layout and responsive web pages in a later chapter.</p> </div> <div class="column content"> <div class="left"><img src="https://www.w3schools.com/w3css/img_lights.jpg" alt=""></div> <h1>The City #2</h1> <p>Chania is the capital of the Chania region on the island of Crete. The city can be divided in two parts, the old town and the modern city.</p> <p>You will learn more about web layout and responsive web pages in a later chapter.</p> </div> <div class="column content"> <div class="right"><img src="https://www.w3schools.com/w3css/img_lights.jpg" alt=""></div> <h1>The City #3</h1> <p>Chania is the capital of the Chania region on the island of Crete. The city can be divided in two parts, the old town and the modern city.</p> <p>You will learn more about web layout and responsive web pages in a later chapter.</p> </div> </div> <div class="footer"> <p>Footer Text</p> </div> </body> </html>
  6. 1 like
    Store the completed state of the form in the session, then check whether the session value is set before showing the panel. You can do this in Javascript with localStorage, sessionStorage or cookies. You can do it in PHP using sessions or cookies.
  7. 1 like
    Depending IF the poster is already using jquery as all i see is plain vanilla JavaScript code, that would overkill just for one small line of code.
  8. 1 like
    <?php session_start(); //start the session for the page include("../include/db.php"); //include database file include("../include/settings.php"); //include configuration file //Check if page was entered by a submit button $email=$_POST['email']; //Get username !!FROM FORM!! $email = ereg_replace(" ", "", $email); //take away all spaces from username (if any) !!FROM FORM!! $password=base64_encode($_POST['password']); //Get name !!FROMFORM!! if (empty($email) || empty($password)) { echo "Empty fields";} else{ //check to see if the username or email allready excists $ck=$flash->prepare("SELECT * FROM `user` WHERE `email`=:email AND `password`=:password "); //get rows where the username or email address is allready registered $ck->bindParam(':email',$email); $ck->bindParam(':password',$password); $ck->execute(); //if email address allready excists if($ck->rowCount() > 0){ echo "user loged in successfully"; } else{ echo "Login or password inccorect";} } ?> use that phpand keep the alert(result); it should be clear now