i am working on a login form and i basically want the user to be able to get redirected on the singup form when he clicks to a link. Any help?
Create an anchor with an href attribute with a link to your signup page as follows
sign up
Can be done simply with HTML href tag like:
Sign Up
If you want to add via php:
echo 'Sign Up';
Read More about href
Related
I am new to php. I have Form on a page with a button that once clicked it pops up another sub page :
onclick="newPopup('page2.php','750','500')
page2.php has another button, I want to be able to redirect the Main Page to another url using this pop-up.
How can I do this?
If you want to redirect the main page on a button click in the popup, you need to do this with JS, not PHP.
Add this to the button in the popup:
onclick="window.opener.location.href='someurl.php'";
From a popup, you can access the page/window that opened the popup with: window.opener. This means that you also can call functions on the main page: window.opener.someFunctionOnTheMainPage().
On click of button, you can execute below JavaScript:
window.opener.location.href = 'new URL';
This will redirect your parent page to the new URL.
after click the submit button on my form, how do I add the anchor "#work" in the url without reloading the page?
example: www.test.it/#work
i use header('Location: #work'); but refresh my page.
Update:
I use "jessica" solution:
I think the page is reloaded
But don't work, ca see here: http://www.substellar.it/ftende/contatti/
I think the page is reloaded
Just add #work to the action in form for it to show up in the link.
<form action = "url#work">
I am using javascript for showing a link in php Codeigniter. But I want
toredirect to a new php page with new tab when click the link . my
controller is loginController and my function is downloadPdf().
how to do this.
my java script is
contentRow += '<div>click here</div>';
and this javascript code will append to div in php code
my need is when i click this link ,i have to pass a parameter to the redirecting page for some process.but with codeignitor
use the HTML a target='_blank' attribute to link.
does anyone know if i can get header in php to take a user to a certain point on a page when a form has been submitted and a function has finished and then it redirects a person back to a certain part of that page?
this is my if result:
$_SESSION['message_sent']="<div class=\"message_sent\"></div>";
header("Location: {$_SERVER['HTTP_REFERER']}");
it currently takes the user back to the page they was on but i want the user to be taken to the middle of the page?
thanks.
try doing as following, take for eg : "test" is the "name" attribute of anchor tag on the page :
HTML CODE :
<a name="test"></a>
<div>
.......
</div>
PHP CODE :
$path = $_SERVER['HTTP_REFERER']."#test";
header("Location:$path");
If you're familiar with having links within a page this should be simple.
You basically have your URL and append the id of the HTML element you want the page to go to when it loads. For example a URL like this:
http://www.mysite.com/index.php#about
Would take you to the following element on the index.php page:
<div id="about"></div>
i have simple coding problem. i have created a page with textbox and share button. the page also contains one Points up button.
i had a problem with that points up button that when the user click on that button and refresh the page ... a window ask for resend of information
for that i have used following code which works fine.
`header('Location: samepageurl.php');
exit;`
but the problem with above code is when user scroll down page and click the button. the page automatically scrolls up. and user have to manually scroll it down.
what i want is the page should refresh but it should be on the same location where it was.
if the problem is still unclear please refer the following images
You can set a fragment identifier.
eg:
<a name="points_up"></a> <!-- this needs to be near that button, the page will scroll exactly where the element is -->
and redirect him to:
header('Location: samepageurl.php#points_up');
die;
Mihai answer is correct, but as you said that fragment identifier is not working because each user has points up button, you can pass user id as a fragment identifier and make a hidden(display : none;) <a> tag and pass the user id in front of each user...
Like this:
You can set a prefix before a user id too (optional)
<a name="pu12345" style="display: none;"></a>
<?php
header('Location: whatever.php#pu12345');
exit;
?>
You can send the request via ajax instead relying on the normal form submission. That will not affect the scrolling of the current page.
Add this line at the bottom of your page before the the <\body> tag
<button id="PageRefresh">Refresh a Page in jQuery</button>
<script type="text/javascript">
$('#PageRefresh').click(function() {
location.reload();
});
</script>