Jump to content

ober

Staff Alumni
  • Posts

    5,327
  • Joined

  • Last visited

Everything posted by ober

  1. I'm going to move this to PHP Help since I doubt the N00bs are going to be able to help and I honestly haven't worked with trees in a very long time and I won't be able to help you either. Hopefully some of our more experienced members will pick this up there. If it drifts, just bump it again.
  2. The @ symbol will stop error messages from being sent to the browser. And there is a thread here: [a href=\"http://www.phpfreaks.com/forums/index.php?showtopic=45685\" target=\"_blank\"]http://www.phpfreaks.com/forums/index.php?showtopic=45685[/a] where you can donate to the site if you wish. Any and all donations are appreciated and go directly to helping with the bandwidth costs the site deals with!
  3. $_GET['page'] will give you "main.php" $_SERVER['SCRIPT_NAME'] will give you "index.php" or "folder/index.php" if you're not executing from the root. $_SERVER['QUERY_STRING'] will give you "page=main.php" (I think)
  4. Try it like this: [code]<?php $email = ""; if(isset($_POST['emailaddress']))     $email =  $_POST['emailaddress']; ?> <input name="emailaddress" id="emailaddress" type="text" maxlength="80" value="<?=$email?>"/><br /> [/code] The reason it's doing that is because you have no way of checking to see if any of the other validations have failed. That's where the error code comes into play. Right now your code says this: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]if email is blank show error if name is blank show error if description is blank show error but if it's not go ahead and send the email.[/quote] As it is, your "else" statement is only tied to the description.
  5. Might I suggest SMF? It's free ;-)
  6. Welcome to the forums. You may want to help us out by explaining what the "Lft/Rgt" columns will contain.
  7. Did you try echoing "$row['part_number']" to make sure something is actually in there? Also, try using mysql_fetch_array instead of mysql_fetch_assoc().
  8. Use: [code]@unlink($PHOTO_Temp); [/code] That will suppress the error you would get if the file doesn't exist.
  9. [a href=\"http://us3.php.net/manual/en/function.mail.php\" target=\"_blank\"]http://us3.php.net/manual/en/function.mail.php[/a] Look at the "how to send HTML emails part: [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]// To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n"; $headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n"; $headers .= 'Cc: birthdayarchive@example.com' . "\r\n"; $headers .= 'Bcc: birthdaycheck@example.com' . "\r\n"; // Mail it mail($to, $subject, $message, $headers);[/quote] Change: [code]if (isset($_POST['description'])){ echo("$_POST['description']"); }; ?>[/code] To: [code]if (isset($_POST['description'])){ echo $_POST['description']; } ?>[/code] You don't need the parenthesis or the quotes when you're just echoing a variable (I never use the parenthesis otherwise either). I also don't understand why you had a ";" after the if closing bracket. That's completely unnecessary. This: [code]<?=isset($_POST['emailaddress']) ? $_POST['emailaddress'] : ''?>[/code] may not work as intended. It's short-code and I always screw it up. You may want to break that out. if(isset($_POST['emailaddress'])) echo $_POST['emailaddress']; else echo "";
  10. Change this: $p_number = "{$row['part_number']}"; to this: $p_number = $row['part_number']; And if you're going to use short tags, use them like this: <th width="208" align="center" valign="middle" scope="col"><input type="text" name="p_number" value="<?=$p_number?>"/></th>
  11. *sigh*... so much you have to learn about giving us enough info. 1) WHAT LINE IS 63????? 2) You can't hide the form without some kind of error code validation. 3) Is the text area filled in now? 4) You're still not using any headers. Did you read the manual entry for mail()???
  12. Put single quotes around the part number. $queryi ="SELECT part_number, quantity_in, part_des FROM parts_db WHERE part_number='M1166'"; or $queryi ="SELECT part_number, quantity_in, part_des FROM parts_db WHERE part_number='$myvar'";
  13. Anytime... post here again if you have issues.
  14. To build the error code, you're going to do something like this: [code]         $error_code = false;     if (empty($_POST['name'])){     $error_code = true;     print('The name field has been left blank<br />');     }if (empty($_POST['emailaddress'])){     $error_code = true;     print('The Email Address field was left blank<br />');     }if (empty($_POST['verifyemail'])){     $error_code = true;     print('The Verify Email Field was left blank<br />');     }if ($_POST['emailaddress'] != $_POST['verifyemail']){     $error_code = true;     print('The Email Addresses do not match, please fix this<br />');     //etc[/code] So then you just check that variable to see if it ran into an error or not. I'm going to guess that your description block is a text area and you're trying to set a value. The text area doesn't have a value... you just have to echo the value between the open and closing tags (but that's just a guess... ). As far as the from header... maybe you should show us your latest code (after you add the above parts).
  15. substr($row['whatever'],0,strpos($row['whatever'], '(');
  16. Whoa whoa whoa... change it to this: [code] if ( $_POST['title'] == "" || $_POST['date'] == "" ) { echo "Some fields were left blank!"; } elseif ( $_POST['new'] == "" ) { echo "You didn't entered the new!"; } else { $query="INSERT INTO news (title,date,new,short_news) VALUES ('$_POST['title']','$_POST['date']','$_POST['new']','$_POST['short_new']')"; if(!mysql_db_query($db,$query)) die(mysql_error()); echo "News added succesfully!"; } ?>[/code] Parenthesis around the evaluation statement, brackets around the if contents.
  17. You need to use headers to set the from address. Look up the mail() function... it lays it out nicely. And if you want to hide the form after the submit, all you have to do is build up an "error code" of some sort so that if it fails validation, it'll show the form, otherwise it won't.
  18. Which is what I told you to do. So is this solved?
  19. SELECT * FROM table ORDER BY newsdate DESC LIMIT 1,1 That will get record #2 The limit clause uses an offset/count format.
  20. Using 2 closing brackets there is going to end your main if which will send the script through the mailing process... HENCE WHAT IS HAPPENING. You have to fix that. Tell us where you're getting the parse error.
  21. You're getting the error on that line because it expects something else to be closed before that. Post your most recent code again.
  22. print_r($array_name) prints out the contents of an array. I wanted you to throw that in at the top so you can see what variables are actually in the $_POST array. When you submit a form, all the current values will be in the $_POST array, so in your form you do something like this: <input name="emailaddress" id="emailaddress" type="text" maxlength="80" value="<?=isset($_POST['emailaddress']) ? $_POST['emailaddress'] : ''?>" /> By the way, you have a double closing bracket before your else. If you move one of those to the end of the PHP block, I think that will fix your issues with having it send on the loading of the page.
  23. It depends on how you want to do it... by words or characters or what. You can use substr($row['mytext'],0,30) to get the first 30 characters, or modify to however you want it. If you want to do it by word count (not as repeatable and extremely variable across stories), do a search on this board as this has been done a hundred times.
  24. The query should have worked as he had it.... I'm really thinking his $totaloptions variable is empty.
  25. Can you show us the code for the entire page, with the changes? And also do this: print_r($_POST);
×
×
  • 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.