Jump to content

Muddy_Funster

Members
  • Posts

    3,372
  • Joined

  • Last visited

  • Days Won

    18

Everything posted by Muddy_Funster

  1. change your \r\n to just \n and double check how many \n's to use for each header line.
  2. $itemList = array(); while ($row = mysql_fetch_assoc($result)){ $itemList[] = $row; } should build you a multidimensional array, one array entry for each item array.
  3. are you sure this is the table you are looking at? " `temp_users` "? if it is in the line imediately following that query add this in a new line: die ($query); and post up what comes up on the screen.
  4. the name of the <select> form element is used for the key name, the value atribute for the <option> form element is used as the value of that key so $_POST['<select element name>'] == <chosen option value atribute> if you set <option value=''> then the value will be an empty string.
  5. ok, try it like this: <?php echo "var_dump:<br>"; $name = array('muddy', 'funster', 'frogger', 'packman'); $output = "<pre>".var_dump($name)."</pre>"; print $output; echo "<br><br><br>print_r:<br>"; $name = array('muddy', 'funster', 'frogger', 'packman'); $output = "<pre>".print_r($name, true)."</pre>"; print $output; ?>
  6. don't use REPLACE in an UPDATE query, it's only for SELECT. Just include the value that you want the field to contain when you have run the UPDATE: UPDATE st SET seats = 'H25/27RO' WHERE body LIKE 'Thomas Tilling' As an afterthought, if you know the exact contnent of the field that you are looking up in the WHERE clause, use = instead of LIKE, it's more efficient: UPDATE st SET seats = 'H25/27RO' WHERE body = 'Thomas Tilling'
  7. that's the code for the form, the bit that people interact with that you posted...Nodral covered the rest while I was typing
  8. no worries, being dyslexic double checking spelling is a matter of course for me
  9. let me know how this works out for you: <?php session_start(); $html1 = <<<HTML_1 <html> <head> <script type="text/javascript" language="JavaScript1.2" SRC="scripts/stm31.js"></script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Sendemail Script</title> <style type="text/css"> <!-- body { background-color:#00CCFF; } --> </style></head> <body> <!-- Reminder: Add the link for the 'next page' (at the bottom) --> <!-- Reminder: Change 'YourEmail' to Your real email --> HTML_1; echo $html1; $ip = $_POST['ip']; $httpref = $_POST['httpref']; $httpagent = $_POST['httpagent']; $visitor = $_POST['visitor']; $visitormail = $_POST['visitormail']; $notes = $_POST['notes']; $attn = $_POST['attn']; #================================================================================================== #this looks for email if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))) #================================================================================================== { echo "<h2>Use Back - Enter valid e-mail</h2>\n"; $badinput = "<h2>Feedback was NOT submitted</h2>\n"; echo $badinput; die ("Go back! ! "); } #================================================================================================== #this making sure all fields have been filled if(empty($visitor) || empty($visitormail) || empty($notes )) { #================================================================================================== echo "<h2>Use Back - Please fill in all fields</h2>\n"; die ("Use back! ! "); } #================================================================================================== #This is looking for captcha ====================================================================== if ($_POST['captcha'] == $_SESSION['captcha']) #==================================================================================================== { $todayis = date("l, F j, Y, g:i a") ; // trying to make it +4 hours more than server time $todayis = time() - (int)substr(date('O'),0,3)*60*60; //this may help with your time offset: /* <?php $date = date_create('2000-01-01'); date_add($date, date_interval_create_from_date_string('10 days')); echo date_format($date, 'Y-m-d'); ?> */ $subject = $attn; $notes = stripcslashes($notes); $message = " $todayis [EST] \n Attention: $attn \n Message: $notes \n From: $visitor ($visitormail)\n Additional Info : IP = $ip \n Browser Info: $httpagent \n Referral : $httpref \n "; $from = "From: $visitormail\r\n"; $attn = strtolower($attn); $attn = trim($attn); switch ($attn){ case "chairperson": mail("email here", $subject, $message, $from); break; case "securtary": mail("email here", $subject, $message, $from); break; case "treausure": mail("email here", $subject, $message, $from); break; case "training": mail("email here", $subject, $message, $from); break; case "expeditions": mail("email here", $subject, $message, $from); break; case "webmaster": mail("email here", $subject, $message, $from); break; default: die ("could not find $attn in contacts"); break; } include "mainmenu.php"; $notesout = str_replace("\r", "<br/>", $notes); $html2 = <<<HTML_2 <p align="center"> <strong>Date:</strong> $todayis <br /> <strong>Thank You :</strong> $visitor <br/> ( $visitormail ) <br /> <strong>Attention:</strong> $subject <br /> <strong>Message:</strong><br /> $notesout <br /> Your IP $ip HTML_2; echo $html2; } #This "else" is for captcha if it is not right nothing will be sent else{ die (" <p align='center'> Captcha was not right please go back and retry ");} ?> <br /><br /> <a href="index.php"> Home </a></p> </body> </html> Another thing, check your spelling for the $attn values against your form values (don't worry about the case - I forced it to lower case for the comparrison. Normaly I would have the form values set to key values for an array in that setup, less chance of slipping a typo in when it's only a single number.
  10. I'm gonna go have a play with that - will post a revision for you when I'm done.
  11. it's one line of code, you would have been quicker testing it yourself if(strlen(trim($_SESSION['cart'])) >= 1) could also be an option
  12. It shouldn't matter where you store the info, as long as you can provide an array for each item that you are p[assing to the checkout it won't make a difference.
  13. hmmm....have you closed this one yet? if ($_POST['captcha'] == $_SESSION['captcha']) #==================================================================================================== {
  14. change these lines here: $va = $row['program_name']; echo "<option value=''>$va</option>"; To the following: $va = $row['program_name']; echo "<option value='$va'>$va</option>"; It is the "value" of the option that is passed as contnent information, the text between the tags is simply for the end users benefit.
  15. elseif() shouldn't matter in this case, Could you humour me and wrap all your if actions in {}, even the ones that are only a single line.
  16. storing the information into a database is as simple as inserting the contnents of the variables that you are using to build the mail. once you have the information then you can use it as many times for as many functions as you like. $to = "[email protected]"; $from = "[email protected]"; $subject = "This Is an Email"; $body = <<<BODY This is your message body. You can store all this into a database either before or after it is sent. BODY; $query = "INSERT INTO myMailTable (m_to, m_from, m_subject, m_body) VALUES ('$to', '$from', '$subject', '$body')"; $insert = mysql_query($query) or die ("$query<br><SPAN STYLE=\"color:red;\">Caused The following error:</SPAN><BR><BR>".mysql_error()); $header_array = array( 'From: '.$from, 'Reply-To: [email protected]',...); $headers = implode ('\n\r', $header_array); $send_it = mail($to, $subject, $body, $headers); echo $send_it;
  17. seriously? you couldn't find a "mail to" form/script on the internet? There are thousands of examples of mail forms, from the simple to->from using php mail() to the complex using server authentication and delayed sending.
  18. put the or die (mysql_error()); at the end of all your mysql_query lines and you will be able to see what the problem is.
  19. you are not assigning the contents of the $updateNames variable to a field. that's why you are getting the error. you either need to tell the query what field you want that information in, or leafe the variable out of that part of the query. : ON DUPLICATE KEY UPDATE cid = '$cat', item = '$item', price = '$price', about = '$about' $updateNames";//<<<--problem line here
  20. I ment in the actual database, there were at least 8 views of this page prior to my posting and too much time has gone by for me to edit now :-\
  21. erm....I think this could have something to do with it if (!empty( $MyCode )) could just be me, but looking at the code it's never realy gonna be empty...is it? P.S. **slaps wrist** stop using short open tags
  22. @ turpentyne : The function that you took your code from isn't being used any more, so you don't need the return $fname; line in there any more...unless this code is all from within a sanitise function, you have chopped off some rather sizeable chunks. Try scootstah's class, and have a read through it, he's taken time out to comment (as too few do these days - myself included most of the time) what it's doing so you can learn a bit more from using it. To display all the errors you would just build an error array and loop through it at the end: $error = array(); if(...){ ... }else{ ... $error[] = "first error message"; } if(...){ ... }else{ ... $error[] = "second error message"; } if(...){ ... }else{ ... $error[] = "third error message"; } if(count($error >= 1){ echo "The following errors occured when processing your submition:<br />"; foreach($error as $message){ echo "$message <br />"; } }
  23. session_start(); needs to go at the very top of your page, just after the <?php line. $query = select from users where username=’$username’ and password=’$password’”; has no opening double quote so your sting is totaly malformed and running into the rest of your code. $dbpass = "c6b7s9t1"; Needs to be changed NOW!
  24. Then you really should be fixing your tables, not working around the problem of duplicate data being in where it shouldn't be.
  25. I use XAMPP From ApachieFriends for my development computers. It's light and well contained, installs everything you need at the first instance.
×
×
  • 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.