Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

PHP SELF : 2 FORMS ONE PAGE.

Featured Replies

I think this is probably pretty much obvious.

 

Basicaly I have a page where there is a php form on every page. (there is probs a much better way of doing this...) and I was under the impression that to post errors on the same page & a thank you message the easiest way of doing it is using PHP SELF. However now i have realized that on the "contact" page i will need another form that i would like to use the same technique..

 

I assume you can't use PHP SELF twice on one page?

 

Page that might help you visualize what i'm trying to do: example

You can use it as much as you want. I dont see why not...

 

There are some security issues with PHP SELF though so do Google it and check them out

Ofc u can use it u are not limited with just one PHP form...

If u dont believe us go ahead and try it ;)

  • Author

hmmm there must be some other error in my code then.. only started using php last week :p

For multiple submits Id just use different names on the submit button and in a nutshell u could do something like:

 

if($_SERVER['REQUEST_METHOD'] == 'POST'){
   if(isset($_POST['submitbutton1'])){
		 //play with form 1
	}

   if(isset($_POST['submitbutton2'])){
		//play with form2
	 }
}
?>
<form action=<?php echo $_SERVER['PHP_SELF'];?>" method="post">
blaaaaaaa

 

Thats litterally the raw elements... Id use a switch personally but you get the idea

  • Author

thank you for that will have a fiddle with it tonight.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.