Jump to content

cyberRobot

Moderators
  • Posts

    3,145
  • Joined

  • Last visited

  • Days Won

    37

Everything posted by cyberRobot

  1. So are you just looking to set a default sort order? In other words, it would default to "price" if $_REQUEST['sort'] isn't set to anything? If so, you could try the following: <?php //IF VARIABLE ISN'T SET, USE DEFAULT if (!isset($_REQUEST['sort']) || empty($_REQUEST['sort'])) { $_REQUEST['sort'] = 'price'; } //SET SORT ORDER if (strpos($_REQUEST['sort'], '|d') !== false) { $osC_Products->setSortBy(substr($_REQUEST['sort'], 0, -2), '-'); } else { $osC_Products->setSortBy($_REQUEST['sort']); } ?>
  2. You'll need to use the full URL. <?php if($_ENV['SCRIPT_URI'] == 'http://www.test.com/index.php' ) { print '<a href="page2.php">Go to page 2</a>'; } ?>
  3. You have two forms named "form". Try changing the name of the table which doesn't have the checkboxes.
  4. You could try using $_ENV['SCRIPT_URI']
  5. If you don't want anything to show up, you don't need the else. The links will only show up when the if conditions are met. Also note that you could use a switch for multiple pages: <?php switch($_SERVER['PHP_SELF']) { case '/index.php': print '<a href="page2.php">Go to page 2</a>'; break; case '/page2.php': print '<a href="index.php">Go Home</a>'; break; } ?>
  6. You could give visitors a regular HTML form to choose which text color they want. The form could submit to a PHP script which stores the color preference in a PHP Session. Your website could then use the session variable to determine which color to use for the text.
  7. Is this what you're looking for: <input id='youtube_code' name='youtube_code' value='<?php echo $_GET['v']; ?>' type='text' placeholder='URL of youtube video' maxlength='100' style='background-color:#555;color:#000; width:50%;'> Note that I changed the input type to "text".
  8. So basically you want the <Player> element to always be added inside the <ArrayOfPlayer> element? If so, have you tried using something like this: http://www.php.net/manual/en/simplexmlelement.addchild.php
  9. This probably isn't the issue, but you have two fields which have both been named "Title": <input type="hidden" name="Title" class="form-control" value="<?php echo $row[0] ?>" > <input type="text" name="Title" class="form-control" value="<?php echo $row[1] ?>" >
  10. The error message says that the second session_start() isn't doing anything. So the script should be fine once removed. Also note that session_start() needs to be called before anything is outputted to the browser. So if the second session_start() was activated, you would get a different error. More information about session_start() can be found here: http://www.php.net/session_start If you're worried about breaking something (or even if you're not), it's a good idea to save a copy of the original working code. That way you can always revert back if needed.
  11. What have you tried? Are you stuck somewhere? Note that I moved the topic to PHP Coding Help.
  12. Have you looked into using file_put_contents() to create the CSS file: http://www.php.net/function.file-put-contents
  13. Here are a list of tags to use within the <item> tag for an RSS feed: http://validator.w3.org/feed/docs/rss2.html#hrelementsOfLtitemgt
  14. Have you looked into something like this: http://www.the-art-of-web.com/javascript/doublesubmit/
  15. Have you attempted to fix the class (and the references to the class)? If so, it may help to post the updated code.
  16. It just mean that you surround code blocks with your code here . Using these tags puts your code in a little box and makes your code (and post) easier to follow.
  17. Please don't double post. It can get confusing when there are multiple threads answering the same question. Note that I hid your other post.
  18. Perhaps you've already seen this, but there's a pinned topic in the Miscellaneous forum for recommended books: http://forums.phpfreaks.com/topic/2307-good-programming-and-web-design-books/
  19. Have you considered using a database? The profiles could be stored in a database and indexed with an ID. You could then pass an ID to a single PHP script which would pull the necessary information from the database.
  20. It should be mentioned that there are a number of other errors, including the missing dollar signs here: if ((!name) || (!email) || (comments)) { Of course, you'll also need to define those variables before the if statement will work.
  21. Assuming that's your complete code, you didn't close the first if statement. Also, the died() function is incomplete. <?php if(isset($_POST['email'])) { // EDIT THE 2 LINES BELOW AS REQUIRED $email_to = "xxxxx@xxxxxxx"; $email_subject = "Your email subject line"; function died($error) { //do function stuff here } if (empty($_REQUEST[$Name])) { echo 'Please go back and fill out ' . $fieldName . "<br>\n"; // validation expected data exists if(empty($_POST['name']) || empty($_POST['email']) || !isset($_POST['comments'])) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } if ((!name) || (!email) || (comments)) { $errorMsg = 'Please make sure you have filled in the required fields:<br /><br />'; } if (!$name) { $errorMsg = 'Please fill in your Full Name<br />'; } if (!$email) { $errorMsg = 'Please fill in your email address<br />'; } } } ?>
  22. You need to name the GET variables. For example: <a href='edit.php?id=". $rows['ID'] ."'>edit</a> Then in edit.php, you can access the variable using $_GET['id']
  23. Based on a cursory look, the class doesn't have any properties. http://www.php.net/manual/en/language.oop5.properties.php However, the class is attempting to use properties which haven't been defined. $this->shoutLog = $shoutLog;
  24. What does your code look like?
  25. Is that the entire code? If so, you're missing the closing PHP tag. //... echo $str; ?> If that doesn't work, have you tried validating the feed? http://validator.w3.org/feed/
×
×
  • 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.