...

View Full Version : Back button



digi duck
02-03-2007, 12:14 PM
Hi, for my site (http://gamesigs.co.uk) i have made it so that after you have created an image you can click on the edit sig button to take you back to the page before where you can reposition the text etc.

The back button code i used is


<input type=button value="Edit Signature"
onCLick="history.back()">

this works fine but when you go back the images checkbox is no longer checked. Its a real pain having to check it every time and most of the time people dont realise it needs to be done.

Is there any way of making the page remember which box was checked and keeping it like that when the back button is pressed.

Thanks a lot Digi.

chump2877
02-03-2007, 12:57 PM
Instead of relying on the brower's history, why don;t you just link to the previous page and repopulate the fields dynamically.

For example, in a page called process_sig.php, you would save the values of your form (from create_sig.php) to a MySQL database, and then give the user the option to go back and edit their signature:


<input type="button" value="Edit Signature"
onclick="window.location='create_sig.php'" />And in create_sig.php:


<?

$query = "SELECT * FROM user_table WHERE name='".$_SESSION['username']."'";
$result = mysql_query($query);

while (@$row = mysql_fetch_assoc($result))
{

?><p>Create/Edit Signature Form</p>
<form method="post" action="process_sig.php" name="form1">
<input type="checkbox" name="checkbox" <?

if ($row['checkbox'] == "checked")
print "checked='checked' ";

?>/>

<textarea name="textarea" cols="20" rows="20"><?

if (!empty($row['textarea']))
print $row['textarea'];

?></textarea>
</form><?

}

?>

digi duck
02-03-2007, 01:05 PM
Unfortunately i cannot do that because my host only gives me 1 database and i have already used it on the forum.

p.s am i correct in thinking that this is a problem only asscoiated with internet explorer, i.e firefox and netscape remember it?

chump2877
02-03-2007, 01:17 PM
Unfortunately i cannot do that because my host only gives me 1 database and i have already used it on the forum.

What prohibits you from creating another table in your database?...your database is only limited by how much space you have used on the server...have you used up all of your allotted server space? If not, then you can create another table...


p.s am i correct in thinking that this is a problem only asscoiated with internet explorer, i.e firefox and netscape remember it?

I don;t know for sure, but just due to the fact that you have noticed a difference among browsers in how the javascript history object works, why would you bother with it? With PHP/MySQL, there are no browser issues to work around...

digi duck
02-03-2007, 04:44 PM
Thanks ill give it a go. I wasnt sure about the database thing cus im a bit of a noob in that area. Amyway thanks for the help.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum