Registration fail, is this fixable?

I have a registration form,


when I click the register button, I get a popup form (pictured) and the URL becomes
image
after registering, the URL still has the #register on the end.
Dont I need to remove it?
heres the logic

   if(empty($errors))
   {
   	$_SESSION['success_message'] = 'Your registration information has been saved. Check your email to complete the registration process.';
   	//die(header("Refresh:0"));	
   	//die(header('Location:'.BASE_URL));	
   	//$url = explode("#",$_SERVER['REQUEST_URI']);	
   	//header('Location:'.$url[0]);

   	
   }

the commented out lines didn’t work

Why is your code putting the #register on the end of the URL at all?

If you are at the point of integrating general purpose registration/login code on a web page, the URL for that page determines what content should be displayed. A popup for an action like registering or logging-in is not the content of the page and shouldn’t change the URL.

The reason for redirecting to the exact same URL of the current page upon successful completion of post method form processing code is to prevent the browser from resubmitting the form data if that URL gets browsed back to or reloaded. If you change the url in any way when you perform this redirect, someone can walk up to a computer, open the browser and enter/navigate to the URL of the form page and use the browser’s developer tools, network tab, to see what the form data is.

I may have screwed up then, heres the link to open up the registation form popup

<a class="btn btn-outline-light btn-sm" href="#register">Register</a>

which adds the #register to the URL, then this is visable

<div id="register" class="overlay">
	<div class="popup">
		<div class="content">
		  <a class="close" href="">&times;</a>
			<div class="alert alert-primary mb-0" role="alert">
		      <h3><i class="fa fa-registered"></i>&nbsp;&nbsp;Register</h3>
			  <hr>
				<div class="alert alert-light border border-light shadow-sm" role="alert">
				  <form method="POST">
...
				  <input type="hidden" name="type" value="register">
				  </form>
				</div>
			</div>
		</div>
	</div>
</div>

Then when I submit it, the URL still has the stupid #. Am I doing it wrong?

or should I use javascript to open a popup

or like

<a href="registration.php" onclick="openRegistration()">Register</a> 

in case javascrpt is disabled.

What is the library/code that actually causes the popup to be displayed?

<a href="#register">Register</a>

I’m using the javascript methodso I dont alter the URL,

<button class="btn btn-outline-light btn-sm" onclick="registerPopup()">Register</button>

but now


If I submit the form without selecting a Troop, I get

the form closes, and the $errors found the error, whe n I click the register button,

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.