Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/01/2024 in all areas

  1. Since PHP 8.3 may have stricter error reporting or handling compared to 8.3.6, this issue might have been silently ignored or handled differently in the previous version. To fix this issue, you should ensure that $forum_id is always set and not an empty string before trying to access $forums['f'][$forum_id]. You can also add a check to make sure the key exists in the array. foreach ($allowed forums as $forum_id) { if (empty($forum_id)) { // Skip this iteration if $forum_id is empty continue; } if (isset($forums['f'][$forum_id])) { $f = $forums['f'][$forum_id]; } else { // Handle the case where $forum_id is not found in $forums['f'] $f = []; // or set a default value, or log an error } $cat_forum['c'][$f['cat_id']][] = $forum_id; if ($f['forum_parent']) { $cat_forum['subforums'][$forum_id] = true; $cat_forum['forums_with_sf'][$f['forum_parent']] = true; } } Check for the existence of the array key using array_key_exists(): foreach ($allowed forums as $forum_id) { if (empty($forum_id)) { // Skip this iteration if $forum_id is empty continue; } if (array_key_exists($forum_id, $forums['f'])) { $f = $forums['f'][$forum_id]; } else { // Handle the case where $forum_id is not found in $forums['f'] $f = []; // or set a default value, or log an error } $cat_forum['c'][$f['cat_id']][] = $forum_id; if ($f['forum_parent']) { $cat_forum['subforums'][$forum_id] = true; $cat_forum['forums_with_sf'][$f['forum_parent']] = true; } } Check for Empty $forum_id: Ensuring $forum_id is not empty helps prevent accessing array keys with empty values. isset() and array_key_exists(): Both functions ensure that the key exists in the array before accessing it. isset() also checks that the value is not null, whereas array_key_exists() strictly checks for the presence of the key regardless of its value. Best Regard Danish Hafeez | QA Assistant ICTInnovations
    1 point
  2. On this site, we do not normally open attachments. In order to post code, use the <> button located in the toolbar. As for your issue, the PHP script will be read by the server when loading the webpage. It is currently doing what you have directed it to do (and has proven that it functions adequately). If you want to change your instructions to not run unless the submit button is clicked, then you have created a new CONDITION that needs to be added to the code. There are several ways to handle this: //let's say this is your button <input type="submit" name="my_submit" value="runPHP"> //Assuming the button is inside a <form method="POST"> tag, you now have several alternatives or combinations to use as conditions <?php if(isset($_POST['my_submit'])){ //code to run if the CONDITION is met hours here } else { //what to do if condition is NOT met echo "Sorry, the button was not clicked"; } //end the condition //OR do this if you want to meet a greater condition if(isset($_POST['my_submit']) && $_POST['my_submit'] == "runPHP"){ //code to run if ALL the CONDITIONs are met } else { //what to do if conditionS are NOT met echo "Sorry, the button was not clicked"; } //end the conditions statement ?> Hope this helps. You can research ISSET and see other examples online.
    1 point
  3. There are about a dozen array keys in that picture. If you want help... Be specific. Post textual code in a code block (<> button) and not a useless picture.
    1 point
This leaderboard is set to New York/GMT-05:00
×
×
  • 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.