Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. Editing and saving the file probably converts the new-lines to something that php can detect by default. See the following note in the fgetcsv documentation -
  2. What exact symptom or error do you get the leads you to believe that pdf files are rejected?
  3. The data will be in $_POST['resid'][0]
  4. // if finished successfully processing submitted data, redirect to same url to clear post data if(empty($errors)){ header("Location:{$_SERVER['REQUEST_URI']}"); die; }
  5. A http 500 response code for a php produced page usually means a fatal parse or fatal runtime error. If your code works on your development system, so that we can assume that it doesn't have a fatal parse error, you are likely getting a fatal runtime error. To help debug a runtime error, add the following two lines of code, immediately after your first opening <?php tag, to see what if any php errors are occurring - ini_set("display_errors", "1"); error_reporting(-1);
  6. Your logic makes no sense. If $comment is not set (the point where your elesif test is at), I can guarantee that it will be empty, because the only way it can be non-empty is if it isset. I recommend that separate your form processing logic so that it is a distinct block of code and the only thing the form processing logic does is process any form data. Any other logic to get and display content on the page should be separate and distinct from your form processing logic.
  7. After you finish processing the POST data, you need to redirect to the exact same URL of the form processing page so that the last action the browser has for that URL is a GET request.
  8. You apparently have a new-line before your <?php tag. You would be getting a header error if you had php's error_reporting set to E_ALL and display_errors set to ON in the php.ini on your development system.
  9. See this reply - http://forums.phpfreaks.com/topic/273391-when-empty-prevent-insert-but-display-a-message/#entry1407090
  10. That code is kind of painful (for php to execute as well.) Each @ error suppressor you have in your code causes the statement it is on to take 2-3 times longer to run, even when there isn't an error being produced (php made this faster in php5.4, but it still takes extra time just because the @ is in your code and you have a lot of them.) You are also repeating each state value three times in each line and you have hard coded all the lines. The following has no need for any @ error suppressors and has no repetition of code/data - <?php $states = array('AL','AK','AZ','AR', ... complete list of the states); $state = isset($state) ? $state : ''; // set to an empty default value if not set in the main code above due to the form submission $option_list = ''; // build list in a variable for output later in the html document foreach($states as $option){ $selected = $state == $option ? ' selected': ''; $option_list .= "<option value='$option'$selected>$option</option>\n"; } ?> <select name="state" class="textfield" id="select"> <?php echo $option_list; ?> </select>
  11. This is a purchased script/theme for WordPress. I recommend that you search/post your question on the templatic forum. Perhaps someone on that forum has already done what you are asking. Moving thread to the 3rd party script forum section, since the forum section where you posted it is for regular expression help...
  12. The method that we generally recommend is to use an array to hold your application error messages. You would add each error message as an element to the array. You can then test at any point if the array is empty or not to decide if you want to do anything. After you have performed all your validation tests, if the array is not empty, you would loop over the entries in it and output the error messages. if it is empty, you would form and run your query and if the query is successful and actually inserts a row, you would output your success message.
  13. The page is actually being redisplayed after the form is submitted, but because it's the same content, it might appear like it isn't. To make the selected option 'sticky', you need to output the selected attribute inside the correct <option > tag. The easiest way would be to dynamically produce the list of options, by making a php array of the values, iterate over the array, and output the selected attribute when the submitted value matches the current option tag being output.
  14. You would mark it solved, so that someone won't take the time to reply in it. Also, I notice that this is in the mysql forum section, but it's not specifically a mysql query problem, so moving it to the php help forum section...
  15. Using mysqli is more than just changing the _query statement. The other database statements must be changed as well to match. Posting your current code would help, and if you are not getting any php detected errors, either you don't have php's error_reporting/display_errors set up or the rest of the code on your page is doing something, like redirecting w/output buffering on, so that the errors are being hidden.
  16. What exactly is being displayed three times? I suspect that the code snippet you posted is inside of a loop that is causing everything, even the <ul>, to be repeated, and not just the < li > < /li > ?
  17. If your log in system has a need to dynamically alter a user's status, such as suspend/ban a member or to promote/demote a member without needing them to re-login for the status change to take effect, you would need to read the database on each page load.
  18. double-post. Topic locked.
  19. I know, he received a warning for them. In fact, this question is substantially the same as in that previous thread I linked to.
  20. You have a previous thread ( http://forums.phpfreaks.com/topic/270708-user-specific-content/ ), where someone (i.e. me) showed how to associate a user id with specific content id's and to retrieve the content for a specific user id (i.e. the currently logged in user.) For a user to 'claim' any content, you would just store a row in the `access_table`, shown in the example queries in that thread, with that user's id and the id of the content.
  21. I noticed that the untested example code I posted was repeating the id = attribute value, which isn't correct. See this revised example code - $tab_content = ''; $gallery_content = ''; $last_gallery = null; $query = "single query that gets the joined information you want in the order that you want it"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)){ // category/tab values $catid = $row['category_id']; $category_name = $row['category_name']; // gallery values $photo_caption = $row['photo_caption']; $photo_filename = $row['photo_filename']; if($last_gallery != $catid){ // cat id changed (or is the 1st one) if($last_gallery != null){ // not the first one, close the previous section here... $gallery_content .= "</div>\n"; } // start a new section here... $tab_content .= "<li><a href='#' rel='view{$catid}'>$category_name</a></li>\n"; $gallery_content .= "<div id='view{$catid}' class='tabcontent'>\n"; $last_gallery = $catid; } // output the data inside a section here... $gallery_content .= "$photo_caption<br />"; $gallery_content .= "<img src='{$images_dir}/tb_{$photo_filename}' border='0'><br />\n"; } // close the final section, if any, here... if($last_gallery != null){ $gallery_content .= "</div>\n"; } // output the HTML document - ?> <ul class="tabs"> <?php echo $tab_content; ?> </ul> <div class="tabcontents"> <?php echo $gallery_content; ?> </div>
  22. See the $_GET array. It already contains the parsed key/value pairs, unless you are doing something unusual, which you didn't show. You also didn't state what incorrect result you are getting vs. what you expect that leads you to believe that you are stuck.
  23. I replied in the PM you sent, but it is worth repeating here - You should be doing this on a development system, with test data, so that you - A) Don't waste your time constantly uploading code to a live server just to see the result of each change, B)You could actually and directly post your test data and the result from that data so as to not waste time with typos in the adulterated sample data you have posted.
  24. Ummm. There's no way the posted data came from the joined query, the previous or the latest one, and even if the OP managed to have a table with different category names (it's likely the made up post had Test1,Test2,... in error) with the same category id, the code detects when the category id changes and would use the first category name. So, none of the recent side trip through never never land in this thread will change anything, until we see the actual output from the query and the actual HTML produced.
  25. I didn't ask what was being displayed, I asked if the HTML being output was correct. I used your implied data in post #10, fixing the incorrect category_name values, and get the expected HTML (\n added after the end of tags to format the output) - <ul class="tabs"> <li><a href='#' rel='view1'>Test1</a></li> <li><a href='#' rel='view2'>Test2</a></li> </ul> <div class="tabcontents"> <div id='view1' class='tabcontent'> test1</br><img src='/tb_1.jpg' border='0'> </div> <div id='view1' class='tabcontent'> test2</br><img src='/tb_2.jpg' border='0'> </div> <div id='view1' class='tabcontent'> test3</br><img src='/tb_3.jpg' border='0'> </div> <div id='view1' class='tabcontent'> test4</br><img src='/tb_4.jpg' border='0'> </div> <div id='view2' class='tabcontent'> test5</br><img src='/tb_5.jpg' border='0'> </div> </div> Therefore, either your data is incorrect, you altered the code and it no longer works, or something else being output on the page is messing up the display of the data. Edit: I did just notice that the <br /> tag you have in your original code is incorrect, though I don't think it is the cause of the wrong output. </br> should be <br> or <br />
×
×
  • 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.