i have set up a page with some button on which load different pages up. the buttons are held within a form and the target is set to blank. this part is fine for the first set of buttons but i need one of them to reload the page but stay in the same window. the code that is getting used at the minute looks like this

<input name="reset" type="image" onclick="broad.php" src="admin/images/reset_btn.gif" /> // this is the button i need to refresh the page in same window

<form id="buttons" method="post" enctype="multipart/form-data" action="<?php echo $PHP_SELF; ?>" target="_blank"> // the code for the form

function changeAction(ins)
{var form1 = document.getElementById('buttons');
if(ins==0)
form1.action = "broad_prev.php";
if(ins==1)
form1.action = "broad_send.php";
if(ins==2)
form1.action = "broad.php" ;
form1.submit();
}

is it possible to get the button to refresh the page without opening a new window?

Recommended Answers

All 3 Replies

Try using this instead of the image input:

<button onclick="window.location.reload()">
<img src="admin/images/reset_btn.gif" />
</button>

that code is still opening a new window. it resets the first page but still opens a new window. also can i put a width on the button as the background button is bigger than the image i am putting over the top of it.

Have u tried setting the target of the form to "_self" like this:

<form id="buttons" method="post" enctype="multipart/form-data" action="<?php echo $PHP_SELF; ?>" target="_self">
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.