Click to See Complete Forum and Search --> : redirect Frame B after clicking submit button on Frame A
beginnerz
11-30-2005, 02:06 AM
Hi,
my problem is i have a frame, let says frame A and frame B. While i click on submit button on Frame A . there are a updating mysql query involved and it need to send a pkey of the table to frame B.
Wrong Example:
if(isset($_POST['Submit'])){
if(!empty($_REQUEST['txtPkey'])){
insert();
}else{
update();
}
}
<input type="submit" name="Submit" value="Submit" onclick = 'parent.frameB.location.href="frameB.php'>
from above when i update on Frame A, it redirect to frameB without updating the table on FrameB because is same execution time, Frame B might not get the updated tables.
I hope there is someone outhere understand my meaning, and might like to share me your opinion. Thanks
Sheldon
11-30-2005, 02:45 AM
Do your php parsing in from B
and link your form to it with
<input type="submit" name="Submit" value="Submit" target="frameB">
beginnerz
11-30-2005, 03:15 AM
What 's important is the update query. when i click submit button on FrameA , it redirect to FrameB on the same time, that's meaning it redirect to FrameB before the update query is executed. That's why on Frame B , Table it don show the updated data. My main problem is at this point. When i click on submit button on FrameA and its update the table , only it redirect to FrameB. Is there a way to do that?
bathurst_guy
11-30-2005, 05:58 PM
if i understand you correctly try this
<form target="FrameB" method....>
I havnt tried it though. This problem isn't a php thing so why did you post it in the php forum?
beginnerz
11-30-2005, 08:23 PM
ok for example:
Example FrameA:
<?
if(isset($_POST['txtItems'])){
$items = $_POST['txtItems'];
}
if(isset($_POST['Submit'])){
$update = 'update stock set items = "'.$_POST['txtItems'].'"';
mysql_query($update) or die('Error, update query failed');
}
$value = 'abc';
?>
<form name='FrameA' method='post' action='<?php echo $_SERVER['PHP_SELF']; ?>'>
<p><input type='text' name='txtItems' ></p>
<p><input type='text' name='txtValueToPassToFramB' value='<? echo $value; ?>'></p>
<p><input type = 'submit' value='submit' name='submit' onclick = 'parent.FrameB.location.href ="../frameB.php?value=<? echo $value ?>";</p>
</form>
Example FrameB
<?
$query = 'select items from stock'
$result = mysql_query($query ) or die('Error, query failed');
?>
<form name='FrameB' method='post' action='<?php echo $_SERVER['PHP_SELF']; ?>'>
?>
<?
echo "<table>";
echo "<tr ><td><strong>Items</bold></strong></tr>";
while($row = mysql_fetch_array($result))
{
?>
<tr>
<td width="300"><? echo $row['items']; ?></td>
</tr>
<?
}
echo "</table>";
?>
I am using onclick to refresh frameB while submiting the updation but frameB Sql havent done it update execution, which is meaning when i update txtItems on FrameA let says, txtItems = sony update to txtItems = motorola, when i click submit, the table on frameB is still showing 'sony' in the table.
Is there a way to solve tis problem?
For my only way is pass the update query to frame B and execute at frame B. but any other way than this?