I have a button from an embedded piece on a page that links to a form that I want to open things in new window but currently, the page opens inside the embedded piece
Of course, I tried target=_blank but that didn't seem to work. I tried onClick="location.href='embed_newstore.php'" but that didn't work either.
<input type="button" name="op" onclick="document.location.href='embed_newstore.php'" id="edit-submit" value="<?php echo $lang['REQUEST_ADD_STORE']; ?>" class="btn btn-primary" style="color:white !important;" target="_blank"/>
expected: embed_newstore.php opens in new window/tab
actual: embed_newstore.php opens in the embed application container
Try with
onclick="window.open('embed_newstore.php');"
Try This
onclick="window.open('http://localhost/embed_newstore.php');"
it is only works if button not inside the form tags
Related
I'd like some help, because I am trying to learn AJAX and I'm stuck. So I have this code here and everything is right, when i press the buttons the information from the PHP file are displayed perfectly.
`<form>
<input type="button" value="req" onclick="fetch('hotels.php?select=1')">
<input type="button" value="req2" onclick="fetch2('hotels.php?select=2')">
<input type="button" value="req3" onclick="fetch3('hotels.php?select=3')">
</form>`
So what I needed to ask is the following: Can I replace the plain classic onclick button with a custom one that I've made in Da Button Factory? I have tried to change the input type to an image, but the problem is that the page is refreshing, when I click it (On the other hand when I just have the classic button onclick it doesn't refresh and the infos are displayed). My programming teacher told me that it must not refresh, as we are working on AJAX right now. Here is what I've tried to do
<input type="image" src="button_london.png" alt="randomtext" value="req2" onclick="fetch2('hotels.php?select=2')">
Any tips?
Input image by default acts as a submit button. If the input type image does the job for you, simply add return false after your onclick function to prevent refreshing.
<input type="image" value="req" onclick="fetch('hotels.php?select=1');return false;">
I want to load a php file when the user clicks on the button, but it isn't working and php file is not loaded. Is there any way to link the php file to the button via anchor tag?
<a href="visual.php" >
<button name="visual" id="newbtn" >Add Visual device</button></a>
<a href="audio.php" ><button name="audio" id="newbtn" >Add Audio device</button></a>
I need to create a main html page which includes only two buttons and when "Add Visual device" button is clicked a php page is loaded with a form to add details about the device to visual device table in sql database. When the "Add Audio device" button is clicked it need to load the php page with form to send the data to the audio table in the db. But nothing loads when the buttons are clicked... I want to load the two pages when the respective buttons are clicked
here is the code to hit php file through anchor tag.
<html>
<body>
visit php file
</body>
</html>
here is the code to hit php file through button.
<form action="audio.php" method="get">
<input type="text" name="id">
<input type="submit" value="Open Form">
</form>
you can do it by adding onclick event as follows
<button onclick="window.location.href = 'audio.php';">Add Audio device</button>
<button onclick="window.location.href = 'visual.php';">Add Visual device</button>
//It can be useful when you are not using a <form> tag.
Currently I am using a hidden form (for reasons decided upon by others, not myself) to act as a link so it can post data with itself. This "link" always opens in the same window, and the general tricks I have tried don't let it open in a new tab instead. This is the current code, any tips?
<tr><td>
<form method="post" action="myPage.php" class="inline">
<input type="hidden" name="submit_parassmHidden" value="extra_submit_value">
<button type="submit" name=".$dataIAmPassingToNextPage." value="submit_value" class="link-button">"
.$linkTitle."</button></form>
</td>";
^Took out the escape slashes to be easier to read, its in PHP, its echo so it shows as regular HTML.
Things like target="_blank" dont seem to be working for me or I am putting them in the wrong place. Anyone have ideas on how I could do this?
EDIT: Since people are saying I can't be doing both, this is what I am doing. It LOOKS like a normal link, there is no form, it IS HIDDEN.
"Ok you're saying 2 different things here. The form is either hidden or you can see the submit link. Both can't be true" <- From comments. Clearly it is true, the form is hidden, and you can see the submit link. However I want these "Links" (which are really buttons in disguise) to open in the new tab.
Unfortunately you have not another option.
target="_blank" or button with formtarget="_blank" in HTML5 (like #CD001 comment) is the solution.
_blank Opens the linked document in a new window or tab depending on the user's browser configuration.
But I saw a little trick here: https://stackoverflow.com/a/15551850/2951051
someone who say to use target="_tab" even if not exist (I dont know if it really work)
<tr><td>
<form method="post" action="http://stackoverflow.com" class="inline" target="_blank">
<input type="hidden" name="input_name" value="extra_submit_value">
<button type="submit" name="form_name" value="submit_value" class="link-button">test</button></form>
</td>
I have a button in my html form that I want it to take user to food.php when they click on it, I did this but it's not redirecting, Please help
<a href="food.php">
<button name="submit" type="button" id="food">Food - Equipment</button>
</a>
Try this:
<button>Food - Equipment</button>
Why use a button element inside a link tag? Why not just:
Food - Equipment
Try that and see if it fixes it.
A button is requested, not a link. Sometimes linked php files don't work as expected in some browsers. Use a form submit button and you'll get what you're looking for.
<form action="food.php" method="GET"> <!-- use get or post if you want
to send anything -->
<input type="submit" value="GO">
</form>
I have dynamic website pages that get products details from database by using GET Method. But problem is that user can't open products listings in new tab of browser. Its just open in same/current browser's tab as there is no option is available in right click menu as "Open in new tab". Any solution please??
Exp:
<form id="form" name="form" action='productdetails.php' method='GET'>
<input name="search" value="<?=$row['ID']?>" type="hidden"></input>
<input type="image" src="http://website.com/products/<?=$row['picture']?>.jpg"></input>
</form>
Now if someone click at image/picture, then "www.website.com/productdetails.php?search=proudcutid" will open in same browser tab. but if he make right click on image and try to open product listing in new tab, he can't as there is no option of "Open in new tab" in right click menu.
I don't want to use _blank as its always open in new browser tab that might be annoying users.
Check this link: http://www.shajam.net/msweaters.php`
use
<a href "..." target = "_blank"></a>
The _blank will open up the targeted url in a new page
1) Add , onclick="javascript:window.open('http://www.facebook.com/', '_blank');"> for opening in new tab.
<input type="button" style="background-color: red" value="Facebook" onclick="javascript:window.open('http://www.facebook.com/', '_blank');">
OR, simply add target="_blank" in <a></a> tag.
2) Link Name