473,396 Members | 1,756 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Refreshing select page content.

TheServant
1,168 Expert 1GB
Hey there again,
I have made a form which allows users to train soldiers depending on whether or not they have the resources. The content concerned is set out like this:

-- Header --
-- Info Bar (how much gold etc available) --
-- Form --
-- Footer --

Here is a screen shot:



Now when I submit the form, it updates everything except for the Info Bar. Obviously when you refresh the page, the Info Bar is correct, but submitting the form doesn't effect the Info Bar at all. I do not want to have the Info Bar in the form!

Is there anyway which I could submit the form (without including the Info Bar in the form) and have that line of code updated?

Thanks for your time!


[PHP]<?php include("../main/header.php"); ?>
<?php include('../age_0/forms/army_form.php'); ?>

<?php
if ($_SESSION['user_name'] == NULL)
{
echo("<p class=\"error\">You have not filled in your username/password. </p><br />");
} else {
?>

<?php
if ($tansaction_confirmed == TRUE) { echo ('<b>Transaction completed!</b>'); }
?>

<?php include('../age_0/army_files/user_race_data.php'); ?>

<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#000000">
<tr>
<td class="TL_2">&nbsp;</td>
<td class="T_2">&nbsp;</td>
<td class="TR_2">&nbsp;</td>
</tr>
<tr>
<td class="L_2">&nbsp;</td>
<td>
<?php include('../age_0/army_files/unit_table.php'); ?>
</td>
<td class="R_2">&nbsp;</td>
</tr>
<tr>
<td class="BL_2">&nbsp;</td>
<td class="B_2">&nbsp;</td>
<td class="BR_2">&nbsp;</td>
</tr>
</table>[/PHP]

[PHP]<?php
if ( ($_SERVER['REQUEST_METHOD'] == 'POST') && isset($_POST['disband_s_f']) && isset($_POST['disband_s_r']) && isset($_POST['disband_s_m']) && isset($_POST['recruit_s_f']) && isset($_POST['recruit_s_r']) && isset($_POST['recruit_s_m']) )
{

if ($_SESSION['user_name'] == NULL)
{
echo("<p class=\"error\">You have not logged in yet. Click <a href=\"../age_0/login.php\">here</a> to login. </p><br />");
} else {


/*-----------------------------------------------------------------------------------------------------------------------
mySQL Connect Code
-----------------------------------------------------------------------------------------------------------------------*/
...
/*-----------------------------------------------------------------------------------------------------------------------
Data Collection Code
-----------------------------------------------------------------------------------------------------------------------*/
...
/*-----------------------------------------------------------------------------------------------------------------------
Buy Code
-----------------------------------------------------------------------------------------------------------------------*/

$new_stats_s_f = ( $_SESSION['stats_s_f'] + $_POST['recruit_s_f'] );
...

mysql_query("UPDATE supwar_stats SET stats_s_f='$new_stats_s_f' WHERE stats_name='$user_name'") or die('I cannot update Stats Table because: ' . mysql_error());
...

...
$_SESSION['stats_s_f'] = $new_stats_s_f;
...
$_SESSION['stats_food'] = $new_stats_food;

$transaction_confirmed = TRUE;

//-----------------------------------------------------------------------------------------------------------------------


}
}
}

?>[/PHP]
Feb 15 '08 #1
5 1540
ronverdonk
4,258 Expert 4TB
You have not shown what PHP code constructs this page. Show any code within the appropriate code tags!

Ronald
Feb 15 '08 #2
TheServant
1,168 Expert 1GB
You have not shown what PHP code constructs this page. Show any code within the appropriate code tags!

Ronald
Updated original post to include that.
Feb 15 '08 #3
ronverdonk
4,258 Expert 4TB
I cannot see a form, so that makes it a bit difficult. You don't have to have the bar in the form itself. Anyway, you can only do this by re-showing the bar-information after submit. So you either re-draw the bar after POST or redraw part of the bar (counter part) in 'real time' (using Ajax) after an event.

Ronald
Feb 15 '08 #4
TheServant
1,168 Expert 1GB
Sorry, I keep forgetting to put in the code where I use include!

[HTML]<form action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="POST">
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#000000">
<tr>
<td width="75" class="title">Units:</td>
<td width="100" class="title">Disband:</td>
<td width="200" class="title">Recruit Cost:</td>
<td width="100" class="title">Recruit:</td>
<td width="100" class="title">Trained:</td>
</tr>
<tr>
<td class="text"><?php echo($user_race_data['races_s_f_n']); ?></td>
<td class="text"><input name="disband_s_f" type="text" value="0" size="4" maxlength="6" /></td>
<td class="text"><?php echo('Gold: '.$user_race_data['races_s_f_cg'].', Food: '.$user_race_data['races_s_f_cf']); ?></td>
<td class="text"><input name="recruit_s_f" type="text" value="0" size="4" maxlength="6" /></td>
<td class="text"><?php echo($_SESSION['stats_s_f']); ?></td>
</tr>
<tr>
<td class="text"><?php echo($user_race_data['races_s_r_n']); ?></td>
<td class="text"><input name="disband_s_r" type="text" value="0" size="4" maxlength="6" /></td>
<td class="text"><?php echo('Gold: '.$user_race_data['races_s_r_cg'].', Food: '.$user_race_data['races_s_r_cf']); ?></td>
<td class="text"><input name="recruit_s_r" type="text" value="0" size="4" maxlength="6" /></td>
<td class="text"><?php echo($_SESSION['stats_s_r']); ?></td>
</tr>
<tr>
<td class="text"><?php echo($user_race_data['races_s_m_n']); ?></td>
<td class="text"><input name="disband_s_m" type="text" value="0" size="4" maxlength="6" /></td>
<td class="text"><?php echo('Gold: '.$user_race_data['races_s_m_cg'].', Food: '.$user_race_data['races_s_m_cf']); ?></td>
<td class="text"><input name="recruit_s_m" type="text" value="0" size="4" maxlength="6" /></td>
<td class="text"><?php echo($_SESSION['stats_s_m']); ?></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#000000">
<tr>
<td class="text" align="right">
<input type="submit" value="Train" />
</td>
</tr>
</table>
</form>[/HTML]
Feb 16 '08 #5
TheServant
1,168 Expert 1GB
Do I have to use frames?
Feb 16 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Philo Del Middleston | last post by:
I've been searching, but apparently not phrasing my search right, so I'm going to float a question out here in the meantime... I'm wondering how to go about refreshing the content of a control...
4
by: Bite My Bubbles | last post by:
I've been doing asp for years but this one stumps me. My pages are not refreshing content. Sometimes they refresh after a minute or two. I've set response.expires=0 response.expires...
3
by: John Ortt | last post by:
I appologise for reposting this but I have been trying to find a solution all week with no avail and I was hoping a repost might help somebody more knowledgable than myself to spot the message... ...
5
by: Jensen Bredal | last post by:
Hello, I need to display self refreshing information on a web page written with asp.net. I would image that the info would be displayed either as part of a user control or a web control. How can...
1
by: Jennyfer J Barco | last post by:
Hello I have a datagrid and a linkbuttom in the datagrid that says Picture, every time I click on the link "Picture" my program opens a popup window showing a picture of the item the selected and...
13
by: honey99 | last post by:
Hi! I have to fix a problem in JSP.Actually,i have a JSP page say Ex1.jsp.In this Ex1.jsp i have an anchor tag which links into another JSP page i.e when i click on the link another pop-up window...
2
by: stevemtno | last post by:
I've got a problem with a web page I'm working on. I have 4 modules - one of them has 2 tabs, two of them have 4 tabs. When the user clicks on the tabs, the content below them changes. However, when...
3
by: gsuns82 | last post by:
Hi all, I am using modal window for some update purpose, the issue i am facing is,i am not able to refresh parent after closing modal window. The code i used: ...
9
by: cleary1981 | last post by:
Hi, I am trying to improve the usabilty of an app I have written and it would be great if I could refresh the content of my select boxes without refreshing the whole page. I am sure this could be...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.