This is a discussion on "Help with echo function on PHP [SOLVED]" within the PHP Forum section. This forum, and the thread "Help with echo function on PHP [SOLVED] are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Help with echo function on PHP [SOLVED]
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
Help with echo function on PHP [SOLVED]
Hi,
I have a registration page: http://www.sapphirediscounts.com/register.php Once you enter the details, it gives the thankyou message but keeps the form etc below. Is there a way I can change it, so once someone clicks the 'register' button, it sends the details and then redirects the user to say /thankyou.php My script is as follows Many thanks Ben
|
|
|
|
#2
|
||||
|
||||
|
re: Help with echo function on PHP [SOLVED]
My idea is that if:
So:
__________________
Jack Franklin - Webforumz Moderator (x)HTML | CSS | PHP | MySQL | JQuery (Javascript) Contact: My Blog | Twitter | Delicious Want Lessons? PM me. If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
|
|
#3
|
|||
|
|||
|
re: Help with echo function on PHP [SOLVED]
Hi,
That bit is fine - but once you have submitted the form, it shows whatever message is in the echo (for example 'Thanks for registering'), but then still displays the original form fields below that text! Therefore users might get confused and resubmit! So I was wanting a script where instead of seeing the text 'thanks for registering', you get directed to another page which has the thankyou message and not the original form still! Any ideas? Many thanks Ben |
|
#4
|
||||
|
||||
|
re: Help with echo function on PHP [SOLVED]
Try using:
__________________
Jack Franklin - Webforumz Moderator (x)HTML | CSS | PHP | MySQL | JQuery (Javascript) Contact: My Blog | Twitter | Delicious Want Lessons? PM me. If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
|
|
#5
|
|||
|
|||
|
re: Help with echo function on PHP [SOLVED]
well the last post works great but another thing you could do is change the forms action value to thankyou.php or w/e you wanted instead of the $_SERVER['PHP_SELF'] super global since that just keeps you on the current page.
|
|
#6
|
|||
|
|||
|
re: Help with echo function on PHP [SOLVED]
Thanks for your comments - just have a few more questions....!
Jack - where in the script would I insert that code you supplied? I had read about adding the URL in the header, but wasn't sure what to add!! luv2php - I take it you mean editing this line: <form action="<?php $_SERVER['PHP_SELF'];?>" method="post"> What would I edit it to? And would it still submit the data to the database? Thanks again for your help with this - am slowing self learning PHP so your advice is very much appreciated! Last edited by sing2trees; Jun 6th, 2008 at 20:33. |
|
#7
|
|||
|
|||
|
re: Help with echo function on PHP [SOLVED]
It should still submit into the db, but it will just redirect you to your new page printing "thanks for registering $username!" or something of that sort. and you would for instance change this line:
<form action="<?php $_SERVER['PHP_SELF'];?>" method="post"> to something like this: <form action="thankyou.php" method="post"> |
|
#8
|
|||
|
|||
|
re: Help with echo function on PHP [SOLVED]
or....you could even create attach an "action" string to the end of your $_SERVER['PHP_SELF'] instead.......
something like: <form action="<?php $_SERVER['PHP_SELF'];?>?action=register" method="post"> which should eliminate all form fields etc... |
|
#9
|
|||
|
|||
|
re: Help with echo function on PHP [SOLVED]
Hi!
Right - I tried the <form action="thankyou.php" method="post"> and it does redirect you to 'thankyou.php' but doesn't submit the data to the database, therefore doesn't work as the registration process! Not sure how the other option would work if the form fields are eliminated! Any ideas?! aghh this is driving me mad!!! |
|
#10
|
|||
|
|||
|
re: Help with echo function on PHP [SOLVED]
eliminated meaning - they will not be shown on the page after its submitted...and sorry about my first try not helping
|
|
#11
|
|||
|
|||
|
re: Help with echo function on PHP [SOLVED]
Hi,
I tried the other option you suggested, but the form fields still show!! Agh just want to make them disappear!! And I really do appreciate you helping - sorry if my post sounded otherwise! Just not sure how to make it disappear! I guess I could look for a new register script, but seeing this one works, I don't really want to! Hmmm. Not sure now!!! |
|
#12
|
|||
|
|||
|
re: Help with echo function on PHP [SOLVED]
Found a code which works!!!
echo '<meta http-equiv="refresh" content="0;url=http://wikipedia.org"/>'; echo 'Please wait'; Where content=0 - the 0 being the time delay!! Thanks again for your help with this!!! |