473,378 Members | 1,544 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

redirecting to the same page

Hi,

I've got a subscription form and I want to make it so once someone hits submit, they are redirected to the same page. I thought maybe there was some code that could grab the URL of the current page and insert it into the redirect value. Here is the code (i believe it's the fifth line):

Expand|Select|Wrap|Line Numbers
  1. <center><form method="post" action="" target="_new"> 
  2. <input type="hidden" name="meta_web_form_id" value=""> 
  3. <input type="hidden" name="meta_split_id" value=""> 
  4. <input type="hidden" name="unit" value=""> 
  5. <input type="hidden" name="redirect" value=""> 
  6. <input type="hidden" name="meta_redirect_onlist" value=""> 
  7. <input type="hidden" name="meta_adtracking" value=""> 
  8. <input type="hidden" name="meta_message" value="1"> 
  9. <input type="hidden" name="meta_required" value="from"> 
  10. <input type="hidden" name="meta_forward_vars" value="0"> 
  11. <table> <tr><td colspan=2><center></center></td></tr> <tr><td>Email:</td><td><input type="text" name="from" value="" size="20"></td></tr> <tr><td>Name:</td><td><input type="text" name="name" value="" size="20"></td></tr>     <tr><td colspan=2><center></center></td></tr> <tr><td align="center" colspan="2"><input type="submit" name="submit" value="Submit"></td></tr> </table> </form>  </center>
How would you go about doing this? Any help would be greatly appreciated.

Thanks!
Oct 20 '08 #1
5 1819
acoder
16,027 Expert Mod 8TB
This won't be possible with HTML. You can either use a server-side language to set the redirect field value during page load or JavaScript to set it when the submit button is clicked.
Oct 21 '08 #2
Alrite, I tried it in php. I'm really not too familiar with php and html, so based on some research I did, this is what I have so far:

Expand|Select|Wrap|Line Numbers
  1. <?
  2. $url = $_SERVER['SERVER_NAME'];
  3. $page = $_SERVER['php_SELF'];
  4. ?> 
  5.  
  6. <center><form method="post" action="" target="_new">
  7. <input type="hidden" name="meta_web_form_id" value="">
  8. <input type="hidden" name="meta_split_id" value="">
  9. <input type="hidden" name="unit" value="">
  10. <input type="hidden" name="redirect" value= <?php echo "http://".$url.$page; ?>>
  11. <input type="hidden" name="meta_redirect_onlist" value="">
  12. <input type="hidden" name="meta_adtracking" value="">
  13. <input type="hidden" name="meta_message" value="1">
  14. <input type="hidden" name="meta_required" value="from">
  15. <input type="hidden" name="meta_forward_vars" value="0">
  16.  
It's not working, but am I onto something? Again, thanks for any help.
Oct 22 '08 #3
eWish
971 Expert 512MB
emumcard,

When posting code sample here at Bytes you are expected to use the tags. Please be sure to use them in the future. For more information on the use of code tags please read the Posting Guidelines "How to ask a question".

Since what you are wishing to do can not be achieved by HTML/CSS and you are trying with PHP I am moving this thread to the PHP Forum for further assistance.

--Kevin
Oct 22 '08 #4
Markus
6,050 Expert 4TB
I believe
Expand|Select|Wrap|Line Numbers
  1. echo "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
  2.  
will do what you want.
Oct 22 '08 #5
I believe
Expand|Select|Wrap|Line Numbers
  1. echo "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
  2.  
will do what you want.
Thanks Markus, how do I format it though? Because when I include the php tags, it doesn't work.
Oct 23 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: lozd | last post by:
Would appreciate any solutions people could offer for this. Basically I wan't to use a frameset with an aspx page as the contents rather than a htm page and I'd like to be able to redirect the...
0
by: Sune Hansen | last post by:
Hi guys, I really hope someone can help me with my problem. Here is the scenario: I have a development environment on my locale machine. Once in a while when everything has been tested I...
1
by: Bilbo | last post by:
Hello, How do I programatically redirect a page in "another frame" using C# in ASP.NET? Server.Transfer redirects the current page...not a different frame. Thanks.
3
by: tony | last post by:
I've been searching through the threads to find a solution for 401.3 error triggered by windows authentication not being able to redirect to a custom error page to no avail. It seems that ASP.NET...
4
by: Greg Smalter | last post by:
Redirecting from page to page within a web project is pretty easy. However, all Redirect methods take strings as arguments, as if you mistype the string, you don't find out until run time that you...
4
by: deepukutty | last post by:
HI all, I am using IE(Internet Explorer) as my default browser for asp.net application development. Today i faced a strange problem. When ever an exception occured in the page ....application...
1
by: sreekeerthi | last post by:
hi friends...this is keerthi...i am doing a project where i want to redirect my page when ever the back button is clicked...for this i am using window.onbeforeunload method..and for page redirection...
41
by: amygdala | last post by:
Hello all, I have posted a similar question in comp.lang.php in the past, but haven't had any response to it then. I kinda swept the problem under the rug since then. But I would really like to...
4
by: damiensawyer | last post by:
Hi, I'm trying to do something in global.asax that I would have thought to be quite simple. Basically, any request at all should get sent to another page. I actually got the code below from a...
3
pradeepjain
by: pradeepjain | last post by:
hii guys, i am redirecting my website to an error page when it cannot connect to mysql database .because of this the url of the page gets changed to error page url .so the user will...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.