Jump to content

PeoMachine

Members
  • Posts

    52
  • Joined

  • Last visited

Everything posted by PeoMachine

  1. Give us the code or the link of that page, please.
  2. You can try to use different types of Exception. You use a "User_Exception" if you have invalid input data or something like that, and a "Database_Exception" for great errors, like loose connection. It can be like this: try { $newUser = new User(); $newUser->setCredentials('user', 'pass'); $newUser->insert(); } catch (Database_Exception $e) { // log this error // stop the script } catch (User_Exception $e) { // Display the error }
  3. Try to send a header with "Content-type"... something like: header('Content-type: application/pdf');
  4. Post your htaccess. Maybe the problem is with him.
  5. I like Sublime Text (http://www.sublimetext.com/). Has a good code highlight, good autocomplete, is thin and beautiful.
  6. change this: $html_output .= "<option selected="; if(isset($_POST['submit'])) { if($_POST['date_year'] == $year) { $html_output .= "\"selected\""; } } $html_output .= ">". $year . '</option>'."\n"; for this: $html_output .= "<option "; if(isset($_POST['submit'])) { if($_POST['date_year'] == $year) { $html_output .= "selected=\"selected\""; } } $html_output .= ">". $year . '</option>'."\n"; Just print "selected=" if you want the option active. You are printing "selected" on all of them. And you can write this way too: $selected = ''; if(isset($_POST['submit']) && ($_POST['date_year'] == $year)) $selected = 'selected="selected"'; $html_output .= "<option $selected>$year</option>\n";
  7. Are you sure thats the right file? I didnt see anything wrong.
  8. What do you have? An result of a select? A finite loop? ...
  9. You are sending these photos by email? If yes, the problem is the email client. If not, post the code to us.
  10. Your relation is: Album has many photos. Right? Your album class should have an structure to store your photos, maybe an array or something like that. class Album { private $id; private $name; private $description; private $photos = array(); }
  11. On that case, you can treat the selected radio and redirect, or put the site on the value of the radio. 1) <?php switch($_POST['payment_method']) { case 'paypal': $redirect = 'www.paypal.com'; // the others } header("Location: {$redirect}"); 2) <label><input type="radio" name="payment_method" value="www.paypal.com" /> Paypal </label> // The PHP does that <?php header("Location: {$_POST['payment_method']}");
  12. I think the path to the file is wrong. Your login page (login.php) in on the root folder ? If yes, when you call the ajax, try to pass '/login.php' instead 'login.php'.
  13. You can use a div, manipulating this with Jquery.
  14. You can do a page with the three options in radio buttons. When you submit this form, you can search for the informations on the database... for example: $sql = "SELECT site FROM payment_method WHERE method = '$_POST['payment_method']'"; $stmt = $database->query($sql); $method = $stmt->fetch(PDO::FETCH_OBJ); header("Location: {$method->site}"); It will redirect you to the correspondent site... Or you can just put the site on the value of the radio button and redirect when the form is submited.
  15. I couldnt understand what you need... In your form you will create 2 arrays with theirs keys numerics ($name and $link). You want to do one array with the two informations? Something like that: $menu = array( 0 => array( 'name' => 'Menu Name', 'link' => 'Menu link', ) ); If yes, you can do something like that: <?php // your other stuff here while($row = $sql->fetch()) { echo "<li id='listItem_".$row['id']."'> <img src='images/arrow.png' alt='move' width='16' height='16' class='handle' /> <input type='text' name='menu[".$row['id']."][name]' value='".$row['name']."' /> <input type='text' name='menu[".$row['id']."][link]' value='".$row['link']."' /> </li>"; $n++; } ?>
  16. Have you tryed to show the PHP Errors? The only problem i can see is in the database incoming data, your PHP looks fine.
  17. What you're trying to do? You can use the uniqid function.
  18. i didnt understand what youre trying to do... if you wanna unset all in the 'cart' index, just do a $_SESSION['cart'] = array();
  19. You should have a declaration of the const PARTIAL, something like: <?php define ('PARTIAL', 'some value');
  20. You can do a Trigger on the database... http://en.wikipedia.org/wiki/Database_trigger
  21. I dont know if i understood... you dont know how to name and organize your classes. I'm right? If yes, read this https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md. This is a convention for naming the files and autoloading classes. You should look the structure of other frameworks like Zend and Symfony too, maybe you will understand.
  22. Try to use the preg_replace function: <?php $cleanData = preg_replace('/[^a-zA-Z0-9]/', '', $inputData); ?> It will remove all thats not between A-Z, a-z and 0-9.
  23. Try yo use the Count function of SimpleXML. simplexml
×
×
  • 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.