Jump to content

Recommended Posts

I ran into a prob here with my includes and forms...

 

I'm trying to call a form action for the current page but since the file is an include and froma different host it's returning that host info. Here is what the page looks like:

 

Page is http://www.site.com/page1.php?ord=354

 

HTML

 

include('http://domain.com/file.php') whcih is

<form action="'. $_SERVER['PHP_SELF'].'" method="get">
<b class="textVerdana">Filter By</b> <select name="sortby" onchange="this.form.submit();">
<option value="id">Id</option>
<option value="aame">Name</option>
<option value="qty">Quantity</option>
</select>
</form>

 

HTML

 

But the $_SERVER['PHP_SELF'] is calling http://domain.com/file.php' when I need it to call http://www.site.com/page1.php?ord=354. Can I do this with PHP or do I need js?

If im understanding you right its possible with PHP or should be.. But Im really sleepy right now so the solution evades me, I deffinately want to say that I think it involves your $_SERVER['PHP_SELF'].. cause the php_self part defines your page your site, not the refering site or link from.

 

But the problem is these urls in mention are the dynamic or static? if they are static why not hard code it.. or are you looking for a specific variable?

 

You need to go more in depth as to what your doing with your page vs. where the other URL is coming from and what its for and so on.. give a live example even :-)

Hmmm... maybe this is a better explanation.

 

URL - http://www.domain.com/mypage.php code is this

 

This is my sort page<br><? php include('http://www.otherdomain.com/sort.php'); ?>

 

The include URL - http://www.otherdomain.com/sort.php

 

<? php
echo '<form action="'. $_SERVER['REQUEST_URI'] .'" method="get">
<b class="textVerdana">Filter By</b> <select name="sortby" onchange="this.form.submit();">
<option value="id">ID</option>
<option value="name">Name</option>
<option value="qty">Quantity</option>
</select>
</form>';

?>

 

So since http://www.otherdomain.com/sort.php is different than http://www.domain.com/mypage.php the $_SERVER['REQUEST_URI'] is returning /sort.php which will cause the form not to work.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.