Jump to content

bltesar

Members
  • Posts

    109
  • Joined

  • Last visited

    Never

Everything posted by bltesar

  1. more information is needed.  Provide the basic structure of your frameset and frames.
  2. More information is really needed to answer this question.  To make checkboxes checked, just add 'checked' at the end of the checkbox tags, e.g. <input type="checkbox" name="chkFolder1" value="001" checked>Soft Drink <input type="checkbox" name="chkFolder2" value="002">Cold Drink <input type="checkbox" name="chkFolder3" value="003" checked>Mineral Water <input type="checkbox" name="chkFolder4" value="004">None This can be achieved in a variety of ways from the database. 
  3. there are a few problems with this code. First, <form action = search.php method = "POST"> should read         <form action = "search.php" method = "POST"> Second, I believe the onsubmit event handler should be in the <form> tag, not the <input> tag. Third, I don't know if the onsubmit event hander can stop the submit from occuring.  I think, but I'm not sure, that the validation function should return true or false, and a false might prevent the submit from going through.  Your validation calls submit again, so it will keep calling itself ad infinitum. I use a different approach (which is why I forget the onSubmit approach).  I do not use a submit button.  Instead, I use a regular button with an onClick event handler that calls the validation function.  If the data is valid, the validation function then submits the form. 
  4. a better option might be to name the POSTed fields with a unique prefix, e.g. eee_varname1, eee_varname2, etc. then use the follwing code: [code] $flag=false; foreach($_POST as $key=>$value) {     if(substr($key, 0, 4)='eee_')     {           $flag=true;     } } if($flag) {     $new='blah, blah, blah...'; } [/code]
  5. The following code should do it: [code] //end any open sessions session_write_close(); //start session to be destroyed session_id($id_of_session_to_destroy); session_start(); //dstroy the session $_SESSION=array(); session_destroy(); [/code]
  6. Did you run the query on the same db table that your php code is accessing?  Is your server set to display errors?  The code is perfectly fine.  Either the database has not been opened properly or the query result is empty. 
  7. I looked into this again, and, alas, I was mistaken.  I had looked at the problem so much, I thought I had tried something I didn't!  I went back, and thank you wildteen, you are correct.  I was not aware of any differences between single and double quotes in PHP (or JavaScript for that matter).  Are there are others I should know about?
  8. Thanks for your reply.  Unfortunately, it did not help me.  Let's say I have a textarea as follows submitted with a carriage return in it- <textarea name="text"></textarea> When receiving the POST, I want to identify and replace the carriage returns entered into the form. The following code does not work: $text=$_POST['text']; str_replace("\r", '', $text);, str_replace("\n", '', $text);, str_replace("\r\n", '', $text); The above functions do not remove the newlines.  If instead I use $newline=" "; as the string to replace, it works!
  9. nl2br() is great for formatting text for HTML output, but it does not actually remove the newlines.  I sometimes need to remove newlines entirely from textarea POSTs (to use as values for JavaScript variables), but the str_replace and related functions do not detect newlines from POSTs using the escaped '\n' or '\r\n' For example, I have found that newlines entered into textareas and submitted via POST cannot be detected with     strpos($mystring, '\r\n'); or strpos($mystring, '\n'); but if I use the following code:     $newline=' ';     strpos($mystring, $newline); the newlines are detected! How can these newlines be detected without actually explicitly defining a newline?
×
×
  • 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.