Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9235103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:56:51+00:00 2026-06-18T06:56:51+00:00

So when I hit submit on the form that is displayed, the page (if

  • 0

So when I hit submit on the form that is displayed, the page (if working properly) should refresh, and the ELSE statement should be displayed instead, but I have 2 problems

The else statement is not displayed until I manually refresh the page
The Pub Score is not updated until the page is manually refreshed either, I think my code placement might be what’s causing it, but I tried to put my form as far down as I could, I’m out of ideas, any help would be great thanks.

<?php
require_once('header.php');
require_once('connectdb.php');
require_once('sessioncheck.php');
if (isset($_SESSION['user_id'])) {
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASS, DB_DATA);

$user_name = mysqli_real_escape_string($dbc, trim($_GET['username']));

$query = "SELECT * FROM blah WHERE username = '$user_name'";

$data = mysqli_query($dbc, $query);
$row = mysqli_fetch_array($data); 

if (mysqli_num_rows($data) != 0) {


if ($row['havemic'] == 1) {
    $micstatus = "Yes";
} else {
    $micstatus = "No";
}
?>




<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title><?php echo $user_name . ' profile' ?></title>
</head>

<body>

<?php 
$commenduser = $user_name;
$query = "SELECT * FROM blah where commenduser = '$commenduser'";
$data = mysqli_query($dbc, $query);
$row = mysqli_fetch_array($data);
$lowerusername = strtolower($username);
$loweruser_name = strtolower($user_name);
    if (mysqli_num_rows($data) == 0) {
    if (isset($_POST['submit'])) {


        $commendplayer = mysqli_real_escape_string($dbc, trim($_POST['commendplayer']));
        $commend = mysqli_real_escape_string($dbc, trim($_POST['commend']));
        $comment = mysqli_real_escape_string($dbc, trim($_POST['comment']));

        if (empty($comment)) {
            echo '<p class="error">Please fillout a comment before submitting</p>';
        } else {

        $query = "INSERT INTO commend (commendby, commenduser, comment) VALUES ('$username', '$user_name', '$comment')";
        mysqli_query($dbc, $query);


        if ($commend == true) {
            $query = "UPDATE blah SET points=points+1 WHERE username='$user_name'";
            mysqli_query($dbc, $query);
            echo '<p class="success">Your commendation has been submitted with + 1 account points.</p>';
        } else {
            echo '<p class="success">Your commendation has been submitted with no affect on the users account points.</p>';
        }


    }
}
}  else {
    echo '<p class="success">You have already submitted a commendation for this player.</p>';
}
?>


<div id="accsettings">
<table cellpadding="5">

<tr><td><label for="username" class="reglabel">Username: </label></td>
<td><label for="username" class="reglabel"><?php echo $row['username']; ?></label></td></tr>
<tr><td><label class="reglabel">Pub Score: </label></td><td><label class="reglabel">

/*This value 'points' should be updated to the new value after form submit */
/*As well the ELSE statement near the bottom should be displayed*/
<?php echo $row['points'] ?></label></td></tr>
<tr><td><label for="steamname" class="reglabel">Steam Name: </label></td>
<td><label for="steamname" id="acclink"><?php echo '<a href="http://steamcommunity.com/id/' . $row['steamname'] . '">' . $row['steamname'] . '</a>'; ?></label>
<tr><td><label for="favchar" class="reglabel">Prefered Hero: </label></td>
<td><label for="favchar" class="reglabel"><?php echo $row['favchar']; ?></label></td></tr>
<tr><td><label for="language" class="reglabel">Spoken Language: </label></td>
<td><label for="language" class="reglabel"><?php echo $row['language']; ?></label></td></tr>
<tr><td><label for="playernote" class="reglabel">Player Note: </label></td>
<td><label for="playernote" class="reglabel"><?php echo $row['note']; ?></label></td></tr>
<tr><td><label for="micstatus" class="reglabel">Has a Mic and VO-IP?</label></td>
<td><label for="micstatus" class="reglabel"><?php echo $micstatus; ?></label></td></tr>

<tr><td colspan="2">Players Comments</td></tr>


<?php
if ($row['commendby'] != $username && $lowerusername != $loweruser_name) {
?>
<tr><td><br></td></tr>
<tr><td colspan="2"><p class="success">Player Commendations/Comments</p></td></tr>
<tr><td><br></td></tr>


<form method="post" action="<?php echo $_SERVER['PHP_SELF'] . '?username=' . $user_name; ?>">
<tr><td><label for="comment">Leave a comment</label></td>
<td><input type="text" name="comment" class="regtext" /></td></td>
<tr><td colspan="2"><label for="commend" class="right">Commend Player?</label><input type="checkbox"  class="right" name="commend" value="yes" /></td></tr>
<tr><td colspan="2"><input id ="submit" type="submit" class="button1" name="submit" value="Submit" /></td></tr>
</form>

<?php
} else {
/*This is what should be being displayed after the form is submitted. But it is not.*/
    $query = "SELECT * FROM blah where commenduser = '$commenduser'";
    $data = mysqli_query($dbc, $query);
    while($row = mysqli_fetch_array($data)) {
        echo '<tr><td><br></td></tr>';
        echo '<tr><td><br></td></tr>';
        echo '<tr><td><label  class="reglabel" for="commendedbyy">Comment From: ' . $row['commendby'] . '</label></td>';
        echo '<td><label class="reglabel">' . $row['comment'];
        echo '<input type="hidden" name="submit" />';
        echo '</form>';


    }

}
?>  

</table>

<?php
} else {
    echo '<p class="error">' . $user_name . ' is not a registered account.</p>';
}
}
else {
    echo '<p class="error">You must <a href="login.php">Log In</a> to view this profile.</p>';
}
?>

</div>
</body>
</html>
<?php
require_once('footer.php');
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:56:52+00:00Added an answer on June 18, 2026 at 6:56 am

    The $row is first grabbed from the database and then the database is updated.

    You can do one of three things, the last being the simplest:

    1. You can refactor the code to change the order
    2. Reload the data using another query after the update
    3. Once you update the points then update the array (i.e. do $row['points'] = $row['points'] + 1;)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a registration form. When I hit the Submit button it should check
I have a form that when the submit is hit i want a modal
I have a form on an HTML page with multiple submit buttons that perform
I have the simplest database entry that when I hit submit, it takes me
I have a upload file form, when you hit Submit it send the file
I have two form elements on my page that act as a smooth login
I have a form that im working on, im trying to reset a field
Ok, So I have a form that is on page 'index.html'. The user submits
I have this form that's a simple topsearch bar like below. There's no submit
I click on items in my listbox and then hit a submit button, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.