Jump to content

cyberRobot

Moderators
  • Posts

    3,145
  • Joined

  • Last visited

  • Days Won

    37

Everything posted by cyberRobot

  1. Hmm...part of my post was cut off. When visiting the form for the first time, POST variables will be empty. Anything passed to SafeDisplay() that's empty will be deleted. To counteract that, you could just skip the method for hard-coded values: <option value='from 2013'>2013</option>
  2. Actually, the problem might be caused the SafeDisplay() method. <?php function SafeDisplay($value_name) { if(empty($_POST[$value_name])) { return''; } return htmlentities($_POST[$value_name]); } ?>
  3. As I think jazzman1 is suggesting, I would first open the form in a browser and check its source code. Does the drop-down menu have the correct value associated with it? If so, you should then try to access the POST variable for the drop-down menu before the instance of the form-processing class is created. For example <?PHP print '<div>Drop-down value: ' . $_POST['years_active_from'] . '</div>'; require_once("./include/fgcontactform.php"); $formproc = new FGContactForm(); ?> If the drop-down value displays, the problem probably lies within the class. Is there anything else that happens before the class instance is created?
  4. Hmm...have you tried using var_dump() or print_r() to see if the POST variables contain what you expect? Of course, you'll want to add the test(s) to the portion of the script which processes the form submission.
  5. One thing that stands out to me is the following line of code: $value = n16br($value); Should that be nl2br()? http://us.php.net/manual/en/function.nl2br.php
  6. Please post the applicable code for reading in the variable and sending out the e-mail.
  7. So where are you having the problem? Are you trying to pre-populate the form...or do you need help with the script which process the form submissions?
  8. Let's break down the code. In the href attribute, you're telling the link to go to the CSS file ("css/alternate.css"). But then you also tack on the actual page address with PHP_SELF. So if your page is called about.php and it's in the root directory, the href attribute would look something like this: "css/alternate.css/about.php?css=red" Does that look correct? First off, I would recommend staying away from PHP_SELF in this case for security reasons. More information can be found here: http://www.cyberscorpion.com/2012-03/why-php_self-should-be-avoided-when-creating-website-links/ You could use the page name, for example. Also, the path to the CSS file shouldn't be included since that's handled by your GET variable ("css"). If your page is named about.php, you would do something like this: <a href="about.php?css=red">[red]</a> Note that you'll need to change the other links too.
  9. I'm actually talking about the source code that results from the following line of code: <a href="css/alternate.css<?php echo $_SERVER['PHP_SELF'].'?css=red'; ?>">[red]</a> The answer to your question should be found there.
  10. What is the href attribute currently set to?
  11. Have you looked at the source code for this? <a href="css/alternate.css<?php echo $_SERVER['PHP_SELF'].'?css=red'; ?>">[red]</a>
  12. Has it been officially deprecated yet? I can't seem to find a record of it being depreciated in HTML 4 or 5. However, I agree that it would be better to use CSS for this case. Note that there are cases where extra emphasis needs to be placed on the text. To do that, you would use the <strong> tag: https://developer.mozilla.org/en-US/docs/HTML/Element/strong
  13. Have you checked if your variables contain values? The var_dump() function can help there: http://php.net/var_dump
  14. Could you post the code instead of attaching it? Don't forget the [ code ][ /code ] tags (without spaces).
  15. The array key needs to be surrounded by quotes. $row['cdata'] EDIT: Sorry, I was responding to the notice in jcbones' response. For some reason I thought that was from the OP. It must be too early.
  16. It looks like you're hard coding the headers argument for mail(): $success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>"); What you're trying to do is shown in Example 2 here: http://php.net/manual/en/function.mail.php Side note: if you haven't done so already, you should review what's available for email injection attacks. https://www.google.com/search?q=php+mail+injection
  17. Huh, color me surprised: http://www.w3schools.com/cssref/css3_pr_font-face_rule.asp But it looks like you've already figured out the solution.
  18. I'm pretty sure fonts don't work that way. I would imagine that this would lead to potential copyright violations. Have you looked at the fonts available through services like Google Web Fonts: http://www.google.com/webfonts
  19. EDIT: Ah, Barand beat me to it For what it's worth, indenting might help avoid issues like this in the future. <?php for($counter = 0;$counter<=$lines; $counter++) { ?> <tr> <td><?php echo $pic_array[$counter];?></td> <td> <form method="POST" action="2php.php" name="form" id="form"> <input type="hidden" name="path" value="<?php echo $PATH; ?>"> <input type="hidden" name="pic" value="<?php echo $pic_array[$counter]; ?>"> <input type="submit" value="<?php echo $pic_array[$counter];?>" name="PDF"></td></tr> <?php } ?> </form>
  20. Have you looked at the source code which was sent to the browser? Do the fields contain what you expect? If so, have you tried echoing the variables in the PHP script which generates the PDF? Do they display values that you expect? If you still need help, it may be helpful to see the newest iteration of the code.
  21. Note that the dot being used in some of the column names (v.good) is a special character. More information can be found here: http://dev.mysql.com/doc/refman/5.0/en/identifiers.html
  22. For security reasons, you may want to consider an alternate approach. As it stands, someone could easily create a form and pass undesired content to the PDF creator. Instead of passing all the image information via the form, you could pass some sort of image ID. The script for generating the PDF would then pull the proper image data based on the ID.
  23. Did you get a chance to look at the link mentioned earlier? http://php.net/manual/en/features.cookies.php More information about setting cookies can be found here: http://www.php.net/manual/en/function.setcookie.php There are also many articles available online for setting cookies with PHP such as this one: http://davidwalsh.name/php-cookies Or you could try Google: https://www.google.com/search?q=create+a+cookie+with+php
  24. Could you just break the strings using something like str_split() and then just merge the arrays? <?php <?php $line1 = '1.2.3.4.5.6.7.8.9.10.11.12.'; $line2 = '1+2+3+4+5+6+7+8+9+10+11+12+'; $line3 = '1-2-3-4-5-6-7-8-9-10-11-12-'; $split1 = str_split($line1, 3); $split2 = str_split($line2, 3); $split3 = str_split($line3, 3); $strOut = ''; $count = count($split1); for($i=0; $i<$count; $i++) { $strOut .= '<div>' . $split1[$i] . $split2[$i] . $split3[$i] . '</div>'; } print $strOut; ?>
  25. I'm probably missing something, but should the first iteration result in the following: 1.21+21-2 If that's the case, would the second iteration result with: .3.+3+-3-
×
×
  • 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.