I have one a page webiste www.yahavi.com (all pages in 1 html) in which different pages are referenced using their div id (eg; #home, #contact ). After successful sign up I want to direct user to my thankyou page with id #thanku . How can i do that using my PHP script that runs after form submission.
home url: www.yahavi.com/#home
form at : www.yahavi.com/#contact
thankyou: www.yahavi.com/#thanku
I am using header (Location: /#thanku) in my PHP but this doesnt work.
Note: I dont want a complete new html page to reload.
You can do it with just PHP. No need for JavaScript or jQuery.
Declare a global variable for storing your base path like this
$BASE_URL="www.yahavi.com/";
and redirect to the specified page like
header("Location:'".$BASE_URL."#thanku'");
You can use javascript on your PHP code like this:
<?php
<script> location.href="#thanku" </script>
?>
Try that. I hope this helps.
UPDATE
If you do AJAX instead, it would be best. After signup, if the user signups successfully, on the javascript file you can use location.href="#thanku".
For that, you would need to do an AJAX request in your signup form.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.