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.

Getting the location that post is being sent from?

Featured Replies

How do i get the location that the data is coming from?

 

I have data coming from file1.html that i want sending to process.php, but process.php needs to know the name of file1 in order to create a variable called file1

 

Basically how do i detect the referring url?

 

The only way i know of is $_SERVER["HTTP_REFERER"]; but i've been told that shouldn't be used. (would it even work for post data?)

HTTP is a stateless protocol. It can provide you with no knowledge of inter-request communications. The best that can happen is a browser by its choice sends you the referring URL (accessed in the way you mention using $_SERVER), or you are fortunate to be able to use sessions (e.g. with a session tracking cookie on the client) to be able to track requests from the same client. Neither are 100% reliable, though more frequently than not they both do work.

 

But here I think your problem is much simpler: why do you not include data on which page the request is coming from in the URL to process.php itself? For example, "process.php?from=file1". Or if file1.html is an HTML form, use a hidden form field - like <input type="hidden" name="from" value="file1" />. That's the most robust method.

  • Author

Hmmm, makes sense.

 

Thanks, looks like i was making a mountain out of a mole hill, as per usual :p

 

I'll post back if i have a problem, but i don't think i will, thanks.

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.