-
Posts
3,145 -
Joined
-
Last visited
-
Days Won
37
Everything posted by cyberRobot
-
Have you considered using PHP's DOMDocument class?
-
Keep checkbox checked after submit refresh
cyberRobot replied to user4245's topic in PHP Coding Help
Is there a reason why your checkboxes have the same name? Are visitors only supposed to check one color? If so, that's what radio buttons are for. If visitors can select multiple colors, you should rename the fields to something like <input type="checkbox" name="color_'.$color.'"... Or you could utilize an array <input type="checkbox" name="color[]"... -
The new value needs to be reassigned to the variable. http://php.net/manual/en/function.str-replace.php $loc = str_replace("\r", '', $loc);
-
redirect all external links thru my website.
cyberRobot replied to preetham's topic in PHP Coding Help
The following plug-in looks to do what you want: http://wordpress.org/plugins/bwp-external-links/ -
Keep checkbox checked after submit refresh
cyberRobot replied to user4245's topic in PHP Coding Help
Sorry, I'm not quite sure what you mean. Posting more of your code might be helpful, especially the code which pertains to the $color variable. -
Keep checkbox checked after submit refresh
cyberRobot replied to user4245's topic in PHP Coding Help
It might help to see the updated code...including the other checkboxes. I suspect that you're using the same $checked variable for all the boxes. The problem is that variable is based on the "color" checkbox. Note: the same affect can be accomplished without the variable: <?php $sidebar_color .= ' ... <input type="checkbox" name="color" value="'.$color.'" onclick="submit();" ' . ((isset($_REQUEST['color'])) ? 'checked="checked"' : '') . ' /> '; ?> Since it looks like you're using XHTML, I changed the checked value to: checked="checked" -
Like Flock, I found Rockmelt distracting. Social networking based browsers probably just aren't for me...too many shiny things. As for your question, the browser doesn't really matter when it comes to PHP. Testing the results from a PHP script is another story. How each browser interprets code like HTML, CSS, JavaScript is what needs monitoring. Do you use a solution like Google Analytics? This should let you know which browsers your customers use. From there, you can judge which browsers to test with.
-
Unable to input data in database - weird problem
cyberRobot replied to benoit1980's topic in PHP Coding Help
The function you're looking for is mysqli_query(). More information (including examples) can be found here: http://php.net/manual/en/mysqli.query.php -
Click Next Button to get the new MySQL Record
cyberRobot replied to NaniG's topic in PHP Coding Help
The previously shown question IDs could be stored in a session variable. More information about sessions can be found here: http://www.php.net/manual/en/book.session.php -
Unable to input data in database - weird problem
cyberRobot replied to benoit1980's topic in PHP Coding Help
You need to execute the query: http://php.net/manual/en/mysqli.query.php -
You could use a counter. For every 4th entry, reset the counter.
-
What errors are you getting? Note: the var_dump() function was added to the expression portion of the third if statement. It needs to go after the curly bracket. if($sql=$db->query("INSERT INTO `kafala`.`std_basic` (`fname` ,`sname` ... '".es("std_siblings")."', '".es("std_mo3arrif")."')")); var_dump($sql); { Also, you should probably review the manual for the header() function. http://php.net/manual/en/function.header.php
-
How can i make this a text-area instead of a input box?
cyberRobot replied to phpnoob11's topic in PHP Coding Help
The value needs to go between the open and close tag: <textarea name="myTextArea" cols="30" rows="10">My Value</textarea> Note: I would highly recommend reviewing the textarea link provided earlier (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea). There are quite a few errors in your textarea code. To help fix the errors, you should run the form through the W3C validator: http://validator.w3.org/ -
Does the GET variable appear in the website URL? Note: the code should be changed to something like this: $product_id = (isset($_GET['product_id'])) ? $_GET['product_id'] : ''; That way $product_id will always be set to something; even if the GET variable is missing.
-
Have you tried the "custom" variable for PayPal? How about using the "return" variable (passing the data through GET variables in the URL)? https://www.paypal.com/cgi-bin/webscr?cmd=p/pdn/howto_checkout-outside Perhaps your answer can be found with a Google search like: https://www.google.com/search?q=passing+variables+through+paypal Note that I don't have a lot of experience with PayPal, so these are just guesses.
-
How can i make this a text-area instead of a input box?
cyberRobot replied to phpnoob11's topic in PHP Coding Help
The value goes between the open and close textarea tags. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea -
Email Subscription not showing name and email
cyberRobot replied to carter90's topic in PHP Coding Help
Hmm...that means the POST variable isn't even being set. Is the form being submitted to the script mentioned in the original post? If so, you should at least get an empty string. string(0) "" What does your form code look like? -
mysql_insert_id() needs to happen after the the query is executed. http://us3.php.net/mysql_insert_id
-
Email Subscription not showing name and email
cyberRobot replied to carter90's topic in PHP Coding Help
Have you tried dumping the POST variables to see if they contain what you expect? For example: <?php $field_name = $_POST['cf_name']; $field_email = $_POST['cf_email']; var_dump($_POST['cf_name']); ?> -
Ah, the function is being called before the page is fully loaded. Try changing the initial call to window.onload = slideit;
-
Are you looking to store the salt in the database with each user record? If so, you need to modify the query to include the salt. It currently only references username, e-mail, and password. $sql = "INSERT INTO list_members(username, email, password) VALUES(:username, :email, :password)";
-
You could employ the $bstatus array by making it an associative array. <?php //ARRAY OF STATUS CODES $bstatus['N'] = 'N/A'; $bstatus['I'] = 'Installation Comp'; $bstatus['SI'] = 'Site Inspection'; $bstatus['S'] = 'Sold'; $bstatus['C'] = 'Cancelled'; $bstatus['P'] = 'Press/Follow-Up'; $bstatus['W'] = 'Being Installed'; ?> Then you would only need to run a simple test to see of the status code exists before using the corresponding value <?php //GET VARIABLE FOR TESTING 'editstatus' $editstatus = $_GET['editstatus']; //IF THE 'editstatus' KEY EXISITS IN THE ARRAY OF STATUS CODES, STORE THE CORREPSPONDING VALUE if(array_key_exists($editstatus, $bstatus)) { $estatus = $bstatus[$editstatus]; } //DISPLAY THE VALUE FROM 'editstatus' print '<pre>' . print_r($estatus, true) . '</pre>'; ?> The array could also be flipped to help with the next test. <?php $bstatus_flip = array_flip($bstatus); //GET VARIABLE FOR TESTING 'cstatus' $cstatus = $_GET['cstatus']; //IF THE 'cstatus' KEY EXISITS IN FLIPPED STATUS CODES, STORE THE CORREPSPONDING VALUE if(array_key_exists($cstatus, $bstatus_flip)) { $dstatus = $bstatus_flip[$cstatus]; } //DISPLAY THE VALUE FROM 'cstatus' print '<pre>' . print_r($dstatus, true) . '</pre>'; ?>
-
Help Please! this was working but no longer! $PHP_SELF
cyberRobot replied to micky1955's topic in PHP Coding Help
Have you tried switching to $_SERVER['PHP_SELF']? Side note: I would recommend staying away from PHP_SELF in this scenario 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/ The alternative would be to just use the page name. <li><a href=<?php echo("photo_gallery3.php?dirchoice=... If you really need to use PHP_SELF, you should look into sanitizing what the variable contains. -
Try removing the line break. document.write("<img src=\"car1.jpg\" name=\"slide\" /> ");
-
You may want to review the following page regarding the use of "var" in classes: http://www.php.net/manual/en/language.oop5.properties.php