-
Posts
3,145 -
Joined
-
Last visited
-
Days Won
37
Everything posted by cyberRobot
-
It seems like the problem is caused by the following line: if(isset($cakesmade[$id][$products])) Basically, the GET variable for "product" is passed with lower case letters. The above test is made against an array where the keys are still mixed case. Have you tried moving the call to array_change_key_case() right after the $cakesmade variable is created?
-
It looks like you're missing the variable name. Try something like this: echo "<a href='alldaymovies/{$row['FileName']}'>View</a>";
-
Since you're using the array syntax in the HTML form (ex: name="productSheets[]"), PHP automatically creates an array for you. So there is no need for the square brackets when assigning the information to $productSheets. Try changing this: $productSheets[] = $_REQUEST['productSheets']; To this: $productSheets = $_REQUEST['productSheets']; Now $productSheets can be treated as a regular array. If you want to display the array as a comma-separated list, you could do something like this: print implode(', ', $productSheets);
-
Having a form insert the data in the database.
cyberRobot replied to laflair13's topic in PHP Coding Help
One way to turn on error reporting it to add the following to the top of your script: <?php error_reporting(E_ALL); ini_set('display_errors', 1); ?> Also, did you try echoing one of your POST variables to see if the expected value is being sent? -
Before anything gets added to the database, you could check if the username (or email) is empty by doing something like this: <?php if($username != '') { //continue processing form } else { //let user know that $username can't be blank } Of course, you'll want to adapt the code so that it checks all the necessary form fields before the script saves anything to the database.
-
Having a form insert the data in the database.
cyberRobot replied to laflair13's topic in PHP Coding Help
Have you tried echoing out one of the POST variables to see if it contains any data? Also, what does your form code look like? -
Could you provide a little more information about what is happening? Does the send.php script redirect at all? Or is there a problem with your form recognizing $_GET['s']? Note that you are using an assignment operator here: if($security = "10"){ You'll need to use two equal signs to make a comparison.
-
Are the item IDs stored in the new_equip table? Assuming they are and the column name is "eid", you could change this: <p><a href="new-product.php?Item=<?php echo $eid; ?>"><?php echo $search_rs ['itemname']?></a></p> To this: <p><a href="new-product.php?Item=<?php echo $search_rs['eid']; ?>"><?php echo $search_rs ['itemname']?></a></p>
-
$().hide(); and .show() is different files - How?
cyberRobot replied to bambinou1980's topic in Javascript Help
Since it looks like you are using jQuery, you'll probably want to use .add() instead: http://api.jquery.com/add/ -
$().hide(); and .show() is different files - How?
cyberRobot replied to bambinou1980's topic in Javascript Help
You could dynamically create the image elements. When a button is clicked, you would unhide the corresponding <div>, create the necessary images with something like document.createElement(), and append the image elements to the <div> using something like Node.appendChild(). From there, you could just hide the <div> if another button is clicked. That way you don't have to load the images again. -
Perhaps if you post the code where you see another email, we may be able to identify the problem. Note that when / if you paste the code, please surround it with tags. It will make your post and code easier to follow. For what it's worth, I would try to trace the variable which contains the email address of interest to see where it's going wrong. Assuming that you used a SESSION variable, I echo the variable out right after using session_start(). If it is correct, I would continue through the script trying to echo out the variable to see where it's getting changed. It sounds like you are overwriting the variable somewhere in the script. What do you use to write your code? Have you tried using that program to search for the variable containing the email. It should give you a basic idea of how the variable is used and where it was potentially overwritten. Note that you'll also want to check any of the scripts being imported into the script having the problem.
-
The header() function in PHP can be used to force the save-as box to appear. Some examples can be found here: http://php.net/manual/en/function.header.php#refsect1-function.header-examples And here: http://php.net/manual/en/function.readfile.php
-
Sorry for the confusion, the wp_mail() function accepts up to 5 arguments. The second argument, the one after the first comma, is where you put the subject of the email. I guess what I was getting at is what are you looking at to know that the email is wrong. Are you looking at the subject of the email? Does that contain the expected email address from $_SESSION['kamail']? Note that the "To" field is being populated from $recipient in the function call below: wp_mail( $recipient, $_SESSION['kamail'], $body, $headers, $attachments ); And the "From" field is set through $headers.
-
Keeping my header and footer on all webpages using PHP?
cyberRobot replied to Coplestone's topic in PHP Coding Help
In your PHP includes, have you tried using root-relative links? That way the includes will work in any folder of your website and you won't need to change them from page to page. Based on the screenshots, it looks like you're using document-relative links. You could try something like this (assuming that the "js" folder is in your root directory): include $_SERVER['DOCUMENT_ROOT'] . '/js/header.php'; -
In your second example, did you try outputting the SESSION variable instead of $Variable1? <?php $Variable1 =($javo_directory_query->get('email')); $_SESSION['kamail']=$Variable1; printf('<li> Variable value:'. $_SESSION['kamail'] .'</li>'); ?> If it displays the correct email, the problem occurs later in your script...or before $Variable2 is displayed.
-
So basically, it sounds like you're trying to populate the three input fields based on the selection made in the "paragraphs" drop down. If that's the case, you shouldn't need to reload the page or form. The following link shows how to populate a second form drop down based on a selection made in the first one: http://www.dyn-web.com/tutorials/forms/select/paired.php Of course, you would need to figure out how to adapt the code to work with text input fields. As for using the drop-down selection to query a database, you could look into using AJAX to contact the server. Or you could look into pre-loading the information into your JavaScript code so that it can be accessed whenever the drop-down menu is changed.
-
Could you provide a little more information about what "doesn't work properly" means? Is it not working at all? Or if it doesn't work as expected, what does it currently do and what do you expect it to do? Also, it may help to see more code. Especially the code where you've applied the onclick attribute. Perhaps you are already aware of this, but please surround the code with tags. It will make your code and post easier to follow.
-
For me that type of information shouldn't be in a heading tag. Perhaps the following quote from the Mozilla Developer Network documentation (https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements) will help: Assuming that you have a blog, the <h1> tag should probably be applied to the blog title. And <h2> tags would be applied to any headings that may be in the blog post...assuming the post is broken into sections.
-
Have you looked into using PHP's DOMDocument class? More information can be found here: http://php.net/manual/en/class.domdocument.php
-
At least I'm not the only person who gets irritated by this type of coding. For me, all those open and close PHP tags add too much noise. The simplicity of having most of my code in PHP outweighs the advantage of code coloring. With that said, I will break out of PHP for large blocks of HTML code.
-
Problem with arrays and multiple values per key
cyberRobot replied to Epimetheus1980's topic in PHP Coding Help
You could try something like this (note that the code is untested): <?php $arr = array(); foreach(explode(';', $string) as $pair) { $author = preg_replace("/([A-Za-z]*)([0-9]*[a-z]?)/", "$1", $pair); $year = preg_replace("/([A-Za-z]*)([0-9]*[a-z]?)/", "$2", $pair); //IF THIS IS THE FIRST ENTRY FOR THE CURRENT AUTHOR, INITIALIZE YEAR ARRAY if(!isset($arr[$author])) { $arr[$author] = array(); } //ADD CURRENT YEAR $arr[$author][] = $year; } foreach($arr as $key=>$val) { echo "<p>" . $key . "</p>"; echo implode('<br>', $val); } ?> -
Problem with arrays and multiple values per key
cyberRobot replied to Epimetheus1980's topic in PHP Coding Help
You could create an associative array where "authorA", "authorB", etc. are the keys. Then just add the years using code similar to this: $authorArray['authorA'][] = 1989; -
Help needed: SELECT specific user data from MySQL in PHP
cyberRobot replied to raneyron's topic in MySQL Help
You'll need to remove the semi-colon here: while($row = $info->fetch_assoc() And it looks like you have any extra curly bracket here: $costMeal = $row['costMeal']; } } echo $startDate . "<br/>"; But perhaps there is more code...and that bracket may be needed. Do you have PHP errors enabled? You can do that by adding the following to the top of your script: <?php //REPORT ALL PHP ERRORS error_reporting(E_ALL); ini_set('display_errors', 1); ?> -
I honestly don't know. If that is a problem, you could try Strider64's suggestion. Or maybe you could rethink how the array information is stored. You could, for example, store the actual name of the cake at the same level as "cakeingredients"...and then do whatever you want with the keys.