-
Posts
3,145 -
Joined
-
Last visited
-
Days Won
37
Everything posted by cyberRobot
-
PHP email send form - help with drop down list on $_POST send form
cyberRobot replied to james909's topic in PHP Coding Help
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> -
PHP email send form - help with drop down list on $_POST send form
cyberRobot replied to james909's topic in PHP Coding Help
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]); } ?> -
PHP email send form - help with drop down list on $_POST send form
cyberRobot replied to james909's topic in PHP Coding Help
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? -
PHP email send form - help with drop down list on $_POST send form
cyberRobot replied to james909's topic in PHP Coding Help
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. -
PHP email send form - help with drop down list on $_POST send form
cyberRobot replied to james909's topic in PHP Coding Help
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 -
PHP email send form - help with drop down list on $_POST send form
cyberRobot replied to james909's topic in PHP Coding Help
Please post the applicable code for reading in the variable and sending out the e-mail. -
PHP email send form - help with drop down list on $_POST send form
cyberRobot replied to james909's topic in PHP Coding Help
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? -
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.
-
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.
-
What is the href attribute currently set to?
-
Have you looked at the source code for this? <a href="css/alternate.css<?php echo $_SERVER['PHP_SELF'].'?css=red'; ?>">[red]</a>
-
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
-
Really need help on php form to update 3 mysql values
cyberRobot replied to Mikesag's topic in MySQL Help
Have you checked if your variables contain values? The var_dump() function can help there: http://php.net/var_dump -
Could you post the code instead of attaching it? Don't forget the [ code ][ /code ] tags (without spaces).
-
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.
-
Need advise on getting the reply function working
cyberRobot replied to roldahayes's topic in PHP Coding Help
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 -
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.
-
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
-
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>
-
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.
-
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
-
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.
-
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
-
turning nested loops into a shorter algorithm
cyberRobot replied to help_me_with_php's topic in PHP Coding Help
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; ?> -
turning nested loops into a shorter algorithm
cyberRobot replied to help_me_with_php's topic in PHP Coding Help
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-