1
JMorris
Send URL through form?
  • 2004/11/12 5:29

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


I'm working on a custom form and I'm having a heck of a time figuring out how to send the url of the page the form is on through the form. Ok, maybe that's a little confusing...

Here's the output I'm trying to acheive.
Quote:

Message Sent From: http://oneofmysites.com/


I've googled the heck out of every combination of url, php, and form that I can come up with. Anybody know how to send the referring url through a form?

I know I can just use....
<input type="hidden" name="referral site" value="http://oneofmysites.com/">


...but I'm looking for a php function that will send the url. That way, no matter how many sites it's used on, all you have to do is upload it. No eding of the url.

2
JMorris
Re: Send URL through form?
  • 2004/11/12 21:06

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


It never ceases to amaze me how often my questions get absolutely no reply. Are they that difficult, or am I just that disliked?

3
Dave_L
Re: Send URL through form?
  • 2004/11/12 21:31

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Actually, we all hate you.

Is the form part of a Smarty template? Or is it created by "echo" statements in PHP?

Depending on the above, you might try:

value="{$_SERVER['SERVER_NAME']}{$_SERVER['PHP_SELF']}"


To figure out which variables to use, you can run the script
() ?>
and look at the PHP Variables section of the output.

4
JMorris
Re: Send URL through form?
  • 2004/11/12 21:36

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


Thank you Dave_L!

Actually, the form, as of the moment, is just a plain 'ol HTML form. I plan to use it with XOOPS and Non-Xoops sites, so I didn't want to use Smarty-specific code. I need it to be flexible.

I'll try your suggestion and see what happens.

Thanks again!

JMorris

5
JMorris
Re: Send URL through form?
  • 2004/11/12 21:47

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


Nope, that didn't work. Here's the code to the form.

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<
input type="hidden" name="cmd" value="_xclick">
<
input type="hidden" name="business" value="xxx@xxx.com">
<
input type="hidden" name="item_name" value="[b][color=990000]need domain url generated here[/color][/b]">
<
input type="hidden" name="amount" value="xx.xx">
<
input type="hidden" name="no_note" value="1">
<
input type="hidden" name="currency_code" value="USD">
<
input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but23.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
form>


I'm trying to create a parking/purchase template that can be used either with, or without Xoops. That's why I need the url inserted via php or javascript. This would be useful for hosting companies, domain registrars, and domain resellers.

6
Dave_L
Re: Send URL through form?
  • 2004/11/12 21:58

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Quote:
Actually, the form, as of the moment, is just a plain 'ol HTML form.


But how is it generated? Is it in an .html file? If you want to use PHP in it, it would need to be in a .php file so that it will be parsed as PHP.

In that case, you could use:
value='echo "{$_SERVER['SERVER_NAME']}{$_SERVER['PHP_SELF']}?>'

7
JMorris
Re: Send URL through form?
  • 2004/11/12 22:01

  • JMorris

  • XOOPS is my life!

  • Posts: 2722

  • Since: 2004/4/11


BINGO! That did it! The only other question I have is... How do I remove the file name from the end of the url? i.e.: /index.php

Thank you!

EDIT: Nevermind... Figured it out... REQUEST_URI

Login

Who's Online

314 user(s) are online (273 user(s) are browsing Support Forums)


Members: 0


Guests: 314


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits