Jump to content

cyberRobot

Moderators
  • Posts

    3,145
  • Joined

  • Last visited

  • Days Won

    37

Everything posted by cyberRobot

  1. Did you remove the single quotes around 'Country'? The query should be $sql = "SELECT Country from w";
  2. Did you try removing the single quotes as Barand suggested? Try changing this $sql = "SELECT 'Country' from 'w'"; To this $sql = "SELECT Country from w";
  3. What error does it give?
  4. There seems to be quite a few options available here: https://www.google.com/#q=javascript+redirect+based+on+cookie+value Is that what you're looking for; perhaps I'm missing something?
  5. No problem; glad to help!
  6. Assuming that you don't want the page to reload every time the "Add Person" button is clicked, this is more of a JavaScript question. Are you familiar with JavaScript...or something like jQuery? Here is a quick jQuery script which seems to do what you are asking: http://jsfiddle.net/jaredwilli/tZPg4/4/ In case it helps, here is the Google search I used to find the above code: https://www.google.com/search?q=javascript%20add%20more%20input%20fields
  7. Sorry I don't have any answers for you. I just wanted to let you (and anyone looking this topic) know that I hid your other topic under the MySQL section. Having duplicate topics can cause confusion among those responding. Especially if both topics get responses.
  8. Have you looked into using HTML image maps? More information can be found here: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/map
  9. As Ch0cu3r suggested, you could use str_replace() to remove them. You could also consider saving the input as is with the newline characters. Then just strip the characters out whenever you display the database content. I guess it all depends on what you're trying to do.
  10. The table column tags need to be surrounded by table row tags (<tr> and </tr>). One of the problems mentioned is likely caused by HTML syntax errors. Passing the page link to the validator would help identify those errors and hopefully fix the problem also.
  11. Have you tried running the code through the W3C Markup Validation Service? http://validator.w3.org/ You have a few syntax errors; one of which is the likely cause to the above issue. The following line opens a table column before the row is open: '<td style width="50%"><tr>'.
  12. Since the form method is set to POST, you'll need to use $_POST['message'] to get the submitted value.
  13. Is there any space before the closing identifier in your HEREDOC statement? $body = <<<EOD <br><hr><br> Name: $namefield <br /> Email: $emailfield <br /> Message: $messagefield <br /> EOD; It's a little difficult to tell since this forum tends to strip out tabs. More information about HEREDOC can be found in the manual (note the warning in the pink box): http://php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
  14. I would imagine that all the date-related functions in PHP functions will be dependent of the time zone set on the server. The time() function, for example, provides different output based on the time zone. <?php print '<div>' . date('H:i:s', time()) . '</div>'; date_default_timezone_set('Africa/Abidjan'); print '<div>' . date('H:i:s', time()) . '</div>'; date_default_timezone_set('Europe/Helsinki'); print '<div>' . date('H:i:s', time()) . '</div>'; ?> If you are trying to get the time from the user's machine, you could look into using a client-side language like JavaScript.
  15. Perhaps this will work: <?php //QUESTION 9 if (empty($_POST["ix"])) { $ixErr = "Please select an answer."; } else { $ix = test_input($_POST["ix"]); // check if question only contains letters and whitespace if (!preg_match("/^[a-zA-Z ]*$/",$ix)) { $ixErr = "Only letters and white space allowed."; } elseif ($ix == "charming") { $score = $score+10; echo "<p>9.) " . $ix . " is correct.</p>\n"; } else { echo "<p>9.) " . $ix . " is incorrect.</p>\n"; } } ?>
  16. You can set the time zone with date_default_timezone_set(): http://php.net/manual/en/function.date-default-timezone-set.php As for the others errors, session_start() needs to be called before anything is outputted to the browser. http://php.net/manual/en/function.session-start.php
  17. The forward slash at the beginning is what makes it a root-relative link. Without the slash, it becomes a document-relative link. Just to clarify, do your images, style sheets, etc. work now...without "http://localhost"?
  18. I'm not sure what you mean. Could you provide an example? Root-relative links always start in the website's root folder. So I'm not seeing why you would need to use syntax associated with document-relative links. Are you talking about the include() function from the original post? If so, the include() function should still use the $_SERVER['DOCUMENT_ROOT'] variable. To reference a file outside (or above) the root, you can use "..". For example: include($_SERVER['DOCUMENT_ROOT'] . "/../file-outside-root.php");
  19. Have you tried root-relative links? Try changing this <img class="header_image" src="http://localhost/cms/assets/image/capture.png" /> To this: <img class="header_image" src="/cms/assets/image/capture.png" />
  20. Yep, that would work
  21. You could build a single page that's populated based on your database? Basically, you build a page that has a space for the summary, images, etc. Then a database row ID is passed to the page which references the business information to show. The ID is used to query the database and retrieve the business information to fill in the spaces.
  22. That's horrible; did anyone get hurt? Well, except for the other driver.
  23. You could assign the keywords to an array and then use implode() to add them to the <meta> tag. <?php //... $keyworddd = array(); for ($i=0; $i< count($queryArray); $i++) { $keyworddd[] = htmlspecialchars($queryArray[$i]); } echo '<meta name="keywords" content="' . implode(', ', $keyworddd) . '">'; ?> Side note: is there a reason you are using mysql_real_escape_string()? That function is for escaping stings that you plan to use in a query. To escape strings being displayed to the screen, you would use something like htmlspecialchars() or htmlentities()
  24. For what it's worth, some would suggest that you avoid inline JavaScript. The "onload" attribute, for example, could be replaced with JavaScript's window.onload event handler. More information can be found here: https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers.onload For more information as to why you might want to switch, you could research "Unobtrusive JavaScript". The following article will get you started: http://en.wikipedia.org/wiki/Unobtrusive_JavaScript
  25. @Nelalen - Just to clarify, you can surround your code with when posting. This makes your code and post easier to follow. Also, as ginerjm suggested, where is $email supposed to come from for this line: $file_dir = "/var/www/html/uploaddir/$email"; If the information is stored in a COOKIE or SESSION variable, you'll need to assign it to $email for the code to work.
×
×
  • 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.