473,800 Members | 2,696 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Refreshing select page content.

TheServant
1,168 Recognized Expert Top Contributor
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_co nfirmed == TRUE) { echo ('<b>Transactio n completed!</b>'); }
?>

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

<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#00000 0">
<tr>
<td class="TL_2">&n bsp;</td>
<td class="T_2">&nb sp;</td>
<td class="TR_2">&n bsp;</td>
</tr>
<tr>
<td class="L_2">&nb sp;</td>
<td>
<?php include('../age_0/army_files/unit_table.php' ); ?>
</td>
<td class="R_2">&nb sp;</td>
</tr>
<tr>
<td class="BL_2">&n bsp;</td>
<td class="B_2">&nb sp;</td>
<td class="BR_2">&n bsp;</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\">her e</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("UP DATE supwar_stats SET stats_s_f='$new _stats_s_f' WHERE stats_name='$us er_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_co nfirmed = TRUE;

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


}
}
}

?>[/PHP]
Feb 15 '08 #1
5 1556
ronverdonk
4,258 Recognized Expert Specialist
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 Recognized Expert Top Contributor
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 Recognized Expert Specialist
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 Recognized Expert Top Contributor
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="#00000 0">
<tr>
<td width="75" class="title">U nits:</td>
<td width="100" class="title">D isband:</td>
<td width="200" class="title">R ecruit Cost:</td>
<td width="100" class="title">R ecruit:</td>
<td width="100" class="title">T rained:</td>
</tr>
<tr>
<td class="text"><? php echo($user_race _data['races_s_f_n']); ?></td>
<td class="text"><i nput name="disband_s _f" type="text" value="0" size="4" maxlength="6" /></td>
<td class="text"><? php echo('Gold: '.$user_race_da ta['races_s_f_cg'].', Food: '.$user_race_da ta['races_s_f_cf']); ?></td>
<td class="text"><i nput 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"><i nput name="disband_s _r" type="text" value="0" size="4" maxlength="6" /></td>
<td class="text"><? php echo('Gold: '.$user_race_da ta['races_s_r_cg'].', Food: '.$user_race_da ta['races_s_r_cf']); ?></td>
<td class="text"><i nput 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"><i nput name="disband_s _m" type="text" value="0" size="4" maxlength="6" /></td>
<td class="text"><? php echo('Gold: '.$user_race_da ta['races_s_m_cg'].', Food: '.$user_race_da ta['races_s_m_cf']); ?></td>
<td class="text"><i nput 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="#00000 0">
<tr>
<td class="text" align="right">
<input type="submit" value="Train" />
</td>
</tr>
</table>
</form>[/HTML]
Feb 16 '08 #5
TheServant
1,168 Recognized Expert Top Contributor
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
5015
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 (say, a selector) without refreshing the page. For example, if I have these selects: Company: <pick a company> Contact: <pick a contact> When they pick the company, I'd like to refill the contact selector based on
4
4523
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 absolute=now() and I have response.expires = immediately in iis6 What else can i do? I also have the dot net framework installed
3
2167
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... I am trying to write a webpage in Javascript. The page loads with three frames, a top, left and right frame. Depending on the users actions the background page rewrites the code for the relevant frames.
5
3487
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 this be done? The information will come from a database and the displaying should loop throug a table in the database. Many thank in advance JB
1
2026
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 information about the item. On the html of the datagrid I have the following: OnItemCommand="Grid_CartCommand" OnItemCreated="DataGrid_ItemCreated". My VB functions are the following: Sub DataGrid_ItemCreated(ByVal Sender As Object, ByVal e As...
13
7458
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 will open.My problem is the pop-up window and the parent window has same combobox.if i add data through html form in pop-up window(Ex2.jsp) it enters the combobox...but the data in the combobox of parent window(Ex1.jsp) is entering only when i refresh...
2
1964
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 the user clicks on the tab (any tab), the browser goes back to the top of the page (I'm assuming it's refreshing, I'm not sure). I'm attaching the JS code below, along with the 2-tab version of the module and its accompanying CSS. Any help will be...
3
9165
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: ------------------------ For opening modal window from parent window: showModalDialog("mypage.jsp",window,"dialogHeight:480px;dialogWidth:700px;");
9
24151
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 done. perhaps using iFrames. Can anyone shed some light?
0
9691
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10279
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9092
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7582
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6815
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5473
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5607
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.