Jump to content

cyberRobot

Moderators
  • Posts

    3,145
  • Joined

  • Last visited

  • Days Won

    37

Everything posted by cyberRobot

  1. No worries; you're definitely not alone! It seems like every time I go through the forums, there at least one topic being duplicated multiple times. And some of those posters have similar stories as you. The Admins, Moderators, and Gurus work hard to remove the duplicate entries in a timely manor.
  2. I marked the topic has solved. For future reference, there is a "Mark Solved" button in lower-right hand corner of each reply box. You would of course click the button that correspondences with the reply that mostly closely answers the question(s).
  3. Have you looked into looping through the results in $_FILES? Note that there are a number of examples in the User Contributed Notes found here: http://php.net/manual/en/features.file-upload.multiple.php#usernotes Basically, you could loop through the files and test the file name as you go. Whenever you run into a file name that isn't set to NULL, process the upload.
  4. For what it's worth, many of the methods could be replaced with a single method that returns the requested variable. Here's a quick example of the direction you could go: <?php //REPORT ALL PHP ERRORS error_reporting(E_ALL); ini_set('display_errors', 1); class testClass { private $_portes = 'Portes'; private $_photo1 = 'Photo1'; private $_photo2 = 'Photo2'; private $_photo3 = 'Photo3'; public function getValue($variableName) { if(isset($this->$variableName)) { return $this->$variableName; } } } $car = new testClass; echo '<div>' . $car->getValue('_photo1') . '</div>'; echo '<div>' . $car->getValue('_portes') . '</div>'; $i = 2; echo '<div>' . $car->getValue("_photo$i") . '</div>'; ?>
  5. Are you able to show what the photo1(), photo2(), photo3() functions look like?
  6. Hmm...the code seems to work for me when I try the following: <?php class testClass { public function photo1() { print '<div>In photo1</div>'; } public function photo2() { print '<div>In photo2</div>'; } public function photo3() { print '<div>In photo3</div>'; } } $car = array(); $car[] = new testClass; $total_photos = 3; for ($i = 1; $i <= $total_photos; $i++) { echo call_user_func(array($car[0], "photo$i")); } ?> Do you know which version of PHP you're using? Is PHP set to show all errors and warnings? Note that you can add the following to the top of your script during the debugging process: error_reporting(E_ALL); ini_set('display_errors', 1);
  7. It looks like you can use the call_user_func() function to dynamically name your class methods. You could try something like the following: <img onmouseover="preview.src=<?php echo call_user_func(array($car[0], "photo$i")); ?>.src" src="<?php echo call_user_func(array($car[0], "photo$i")); ?>" alt=""/>
  8. If that doesn't work...which it probably won't, where does $car come from. Are you able to show the code where photo1() is defined? I imagine that it comes from a class definition. If that's correct, does the class have multiple methods like photo1(), photo2(), etc.?
  9. Is it perhaps that this <img onmouseover="preview.src=<?php echo $car[0]->photo . $i . '()';?>.src" src="<?php echo $car[0]->photo1()?>" alt=""/> Needs to be changed to this <img onmouseover="preview.src=<?php echo $car[0]->photo . $i . '()';?>.src" src="<?php echo $car[0]->photo . $i . '()'; ?>" alt=""/>
  10. As ginerjm mentioned, the PHP code shown is used to display the form. Do you have any code that processes the form submission? Basically, it would help to know where you're stuck? Which field(s) are you looking to validate? And what is considered valid? If you're looking for help on the basics of form validation and/or processing form submissions, there are many resources online: https://www.google.com/#q=php+form+validation
  11. Perhaps the following will help: http://php.net/manual/en/features.file-upload.multiple.php
  12. Try changing this <td><a href="customers.php?t=customer&id=<?php $id ?>"><?php echo $name; ?></a></td> To this <td><a href="customers.php?t=customer&id=<?php echo $id; ?>"><?php echo $name; ?></a></td>
  13. For what it's worth, I've just gotten into the habit of pasting things into something like Notepad. Then copy and paste it into the forum. Turning off the WYSIWYG editor is probably a quicker way to go. But this forum is unlikely to be the only place where you'll have problems. I've had similar problems with many Content Management Systems, for example.
  14. No problem, glad you figured it out! Note that I marked the topic as solved. If you need anything else, you can mark it as unsolved...or start a new topic.
  15. For what it's worth, here some more information about password hashing: http://php.net/manual/en/faq.passwords.php
  16. You can use mysqli_fetch_assoc() instead of row: http://php.net/manual/en/mysqli-result.fetch-assoc.php
  17. Just to clarify, does $product->getMediaGallery() contain an array? If so, you should be able to use a foreach loop (or loops) to get all the 'url' parts.
  18. If the function is needed for multiple pages on your website, then it would be a good idea to save the definition in an external file and import it as needed. Note that you would want to use require instead of include since the function is critical to the operation of the page. More information about require can be found here: http://php.net/manual/en/function.require.php
  19. The problem is caused by the function definition being made inside a loop. The code should work if you move the definition as mentioned by mac_gyver. You could try something like the following: <?php ini_set('display_errors', 1); error_reporting(E_ALL); include "include/session.php"; include('config.php'); $email = $_SESSION['mem_id']; function genQtyList($item_sold, $qtyMax = '$qty', $qtyMin = 1) { $html = "\n<select name=\"$item_sold\">\n"; for($i = $qtyMin; $i <= $qtyMax; $i++) $html .= "\t<option>$i</option>\n"; $html .= "</select>\n"; return $html; } ?>
  20. You shouldn't need to re-declare the function... Could you post the code which shows all the calls / decorations of genQtyList()?
  21. Which index is it referring to? The one for $_REQUEST...or the one for $sortOptions? To avoid this type of error, you could use isset(): $sort = (isset($_REQUEST['sort']) && isset($sortOptions[strtolower($_REQUEST['sort'])])) ? strtolower($_REQUEST['sort']) : 'name';
  22. Thinking about the problem some more, I have a feeling that there is some JavaScript attached to the form that's adding the action and method attributes for you. Did you make any changes to the open <form> tag after downloading script? When you submit the form, where does it go? Does it go back to the page where your form code is hosted? Or does it go to contact_me.php in the mail folder?
  23. The extra attributes would go in the following <form> tag: <form name="sentMessage" id="contactForm" novalidate> Note that the attribute order doesn't matter.
  24. Have you checked to see of $post->ID contains a value? How about get_the_ID(); does it return a value? Note that get_the_ID() needs to be called within The Loop. More information can be found here: https://codex.wordpress.org/Function_Reference/get_the_ID
×
×
  • 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.