Jump to content

viviosoft

Members
  • Posts

    85
  • Joined

  • Last visited

About viviosoft

  • Birthday 04/27/1975

Contact Methods

  • Website URL
    http://www.viviosoft.com

Profile Information

  • Gender
    Male
  • Location
    Ohio

viviosoft's Achievements

Member

Member (2/5)

0

Reputation

  1. Because you have error checking set in your code. Any PHP errors (like "Undefined variable") will be displayed. If you were to comment those two lines out, you would most likely not have seen those errors. It's a nice thing sometimes to be able to debug using the below two lines of code in PHP. However, sometimes those two lines of code could create error messages that you may not care about. error_reporting(E_ALL); ini_set('display_errors', True); Happy Coding!!
  2. Your are most welcome. In your code. I notice $body = "Name: $Name\n\n Email: $Email\n\n Comments: $Comments" Where are $Name, $Email, and $Comments getting set? I believe that's where the error is happening. They this and see what happens. <?php error_reporting(E_ALL); ini_set('display_errors', True); $path = '/home/***/php'; set_include_path(get_include_path() . PATH_SEPARATOR . $path); // Set the email variables from the form here: $Name = $_POST['Name']; // Pass the Name value to the $Name variable $Email = $_POST['Email']; // Pass the Email value to the $Email variable $Comment = $_POST['Comment']; // Pass the Comment value to the $Comment variable require('Mail.php'); $from = "Info <info@**.co.uk>"; $to = "Info <info@**.co.uk>"; $subject = "Hi - Test message!"; $body = "Name: $Name\n\n Email: $Email\n\n Comments: $Comments"; $host = "mail.**.co.uk"; $username = "info@**.co.uk"; $password = "***"; $headers = array('From' => $from, 'To' => $to, 'Subject' => $subject); $smtp = Mail::factory('smtp', array('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body); if (PEAR::isError($mail)) { echo("<p>" . $mail->getMessage() . "</p>"); } else { echo("<p>Message successfully sent!</p>"); } ?>
  3. Wow! I guess I should have waited to post . I figured out a solution. Well, I didn't I found the solution on php.net. Here's what I found for those that might have the same problem. <?php var_dump(remove_duplicate($farmData, 'farmName')); function remove_duplicate($array, $field) { foreach ($array as $sub) $cmp[] = $sub[$field]; $unique = array_unique($cmp); foreach ($unique as $k => $rien) $new[] = $array[$k]; return $new; } ?>
  4. It would be nice if I could retain the key names in the initial array. Here's the output now. The method I'm using "works" but I loose the other keys in the array. <?php $dup_name = array(); foreach ($farmData as $farm) { $single_name = array_merge($dup_name, explode(",", $farm['farmName'])); } var_dump(array_unique($single_name)); ?> Output: <?php array 0 => string 'Hallinan' (length= 1 => string 'Holt' (length=4) 6 => string 'Home' (length=4) 9 => string 'Kenyon' (length=6) 19 => string 'Lane' (length=4) 21 => string 'Leach' (length=5) 23 => string 'Robinson' (length= 24 => string 'Shorey' (length=6) 26 => string 'Stream' (length=6) ?>
  5. I think this will do what I'm after. If there's a cleaner way or another approach, by all means please... $dup_name = array(); foreach ($farmData as $farm) { $single_name = array_merge($dup_name, explode(",", $farm['farmName'])); } var_dump(array_unique($single_name));
  6. On your select statement using the following to see any errors you might be getting: $sql = 'SELECT * FROM `'.$tbl_name.'`'; $result = mysql_query($sql) or die(mysql_error()); // <-- Adding or die(mysql_error()); will help you determine if you have any errors in your query You need to start you php echos with <?php NOT <? . Thy this and see if you get any results in your table. <?php while ($rows = mysql_fetch_array($result)): ?> <tr> <td align="center" bgcolor="#FFFFFF"><input name="need_delete[<?php echo $rows['msgid']; ?>]" type="checkbox" id="checkbox[<?php echo $rows['msgid']; ?>]" value="<?php echo $rows['msgid']; ?>"></td> <td bgcolor="#FFFFFF"><?php echo $rows['Id']; ?></td> <td bgcolor="#FFFFFF"><?php echo htmlspecialchars($rows['Username']); ?></td> <td bgcolor="#FFFFFF"><?php echo htmlspecialchars($rows['Message']); ?></td> <td bgcolor="#FFFFFF"><?php echo htmlspecialchars($rows['Subject']); ?></td> </tr> <?php endwhile; ?>
  7. I believe your error message is coming from the Mail class you are using. There's a lot more code in your second code example. I would start small and ONLY use what the Mail class requires to send the email. Take out the validation and the like and start there. Strip it down. Start by passing the values without the Mailer functions. For example: Echo the form values after you have submitted the form and see of you are getting those passed okay. Then move to your Mail operation. Once you get that working then move to your validation and the like. Comment out ALL your code in form-mailer2.php and add the following. If you don't see any data at all then you have a problem with calling your form-mailer2.php file. <?php echo 'Your posted values are: '; echo $_POST['Name']; echo $_POST['email']; echo $_POST['comment']; ?>
  8. Are you wanting to delete to delete record from the database when the user checks the box? If so, you'll have to use javascript to perform that action. OR are you using a POST action to perform the action? For example, the user checks the box then clicks Submit to perform the delete action.
  9. You could try passing the values using jQuery (AJAX). That way the data isn't being seen by the end-user in the address bar. http://api.jquery.com/jQuery.ajax/ The some.php would handle your database inserting. You would "get" the score and game values from hidden fields on the form. Hope this helps. This is not the place to discuss jQuery or Ajax so I can't go into great detail. There's quite a bit of information out there about how to pass data using jQuery and Ajax. I've sure this will get you started in the right direction. $.ajax({ type: "POST", url: "some.php", data: "score=100&game=4" }).done(function( msg ) { alert( "Data Saved: " + msg ); });
  10. What does your user table look like? That values do you capture in your user table?
  11. Hello All - I have the following array: array 0 => array 'farmName' => string 'Hallinan' (length= 'farmInsNum' => string '' (length=0) 'farmFSA' => string '' (length=0) 1 => array 'farmName' => string 'Holt' (length=4) 'farmInsNum' => string '' (length=0) 'farmFSA' => string '' (length=0) 2 => array 'farmName' => string 'Holt' (length=4) 'farmInsNum' => string '' (length=0) 'farmFSA' => string '' (length=0) 3 => array 'farmName' => string 'Holt' (length=4) 'farmInsNum' => string '' (length=0) 'farmFSA' => string '' (length=0) 4 => array 'farmName' => string 'Holt' (length=4) 'farmInsNum' => string '' (length=0) 'farmFSA' => string '' (length=0) 5 => array 'farmName' => string 'Holt' (length=4) 'farmInsNum' => string '' (length=0) 'farmFSA' => string '' (length=0) 6 => array 'farmName' => string 'Home' (length=4) 'farmInsNum' => string '' (length=0) 'farmFSA' => string '' (length=0) 7 => array 'farmName' => string 'Home' (length=4) 'farmInsNum' => string '' (length=0) 'farmFSA' => string '' (length=0) 8 array 'farmName' => string 'Home' (length=4) 'farmInsNum' => string '' (length=0) 'farmFSA' => string '' (length=0) The data comes from a flat file that has (as you can see) many of the same names like Home and Holt. Is there a way to extract the first Holt and Home from the array and put those values in a new array? So my new array would look something like: array 0 => array 'farmName' => string 'Hallinan' (length= 'farmInsNum' => string '' (length=0) 'farmFSA' => string '' (length=0) 1 => array 'farmName' => string 'Holt' (length=4) 'farmInsNum' => string '' (length=0) 'farmFSA' => string '' (length=0) 2 => array 'farmName' => string 'Home' (length=4) 'farmInsNum' => string '' (length=0) 'farmFSA' => string '' (length=0) I look through php.net and really couldn't find a function that could handle what I was after. I'm sure I'd have to use a combination of each() and reset() or maybe not? Any help would be very welcome. Thanks!
×
×
  • 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.