Member Avatar for ShandyElliott

What I have:
a. I have a contact.htm page with a form on it. I have a drop down menu in which I have several options the user can choose to select a subject matter.

b. a footer (which acts as a site map) on the bottom of all web pages.

What I'm trying to do:
On the footer, there is a link called "feedback". When the user clicks it, I want to send them to the form on the contact.htm page and have that drop down subject list already selected as "feedback". I'm sure it's just a matter of passing a variable from the page with the footer to the contact.htm page. I would imagine on the contact page I would do a body onload function to set the drop down list <option> value = "feedback". I just can't figure out how to pass a variable across the page.

I've uploaded parts of each page if anyone needs to test on actual content.
http://www.shan-dysigns.com/test/footer.htm acts as the footer

http://www.shan-dysigns.com is most of the contact page/test/contact.htm is most of the contact page.

I removed any unrelated content for privacy, but there should be enough there to test.

Thanks for any advise...

Nice looking site i must say :)

1. If you can use php then
a)

$_SERVER['HTTP_REFERER']

should help. Just use this on the contacts page to check if the referer was feedback
b) You can edit the feedback url into something like this

http://www.shan-dysigns.com/test/contact.htm?referrer=feedback

and then use

if($_GET['referrer'] == 'feedback')

to decide which drop down value to populate.
You may also POST this information in case you want cleaner urls

2. You may simply use

document.referer

in javascript and confirm if the referrer was the feedback page to do this as well

Let me know if this helped

Member Avatar for diafol

Your dropdown is generated dynamically by php? If so, this is easy to cater for

$page = basename($_SERVER['PHP_SELF']);
//label, url, ext
$dropdown_list = array(array("label1", "profile.php",false),array("label2","about.php",false),array("label3","http://www.example.com",true));
//Build dropdown (usually a ul list)
$list = "\n<ul>";
foreach($dropdown_list as $dd){
  $ext = "";
  if($dd[1] == $page){
     $list .= "\n\t<li class=\"currentpage\">{$dd[0]}</li>";
  }else{
     if($dd[2])$ext = ' target="blank"'; //this is optional - sometimes frowned upon too
     $list .= "\n\t<li><a href="{$dd[1]}"{$ext}>{$dd[0]}</a></li>";
  }
}
$list .= "\n</ul>";

...

echo $list;

Not tested.

Member Avatar for ShandyElliott

Nice looking site i must say :)

1. If you can use php then
a)

$_SERVER['HTTP_REFERER']

should help. Just use this on the contacts page to check if the referer was feedback
b) You can edit the feedback url into something like this

http://www.shan-dysigns.com/test/contact.htm?referrer=feedback

and then use

if($_GET['referrer'] == 'feedback')

to decide which drop down value to populate.
You may also POST this information in case you want cleaner urls

2. You may simply use

document.referer

in javascript and confirm if the referrer was the feedback page to do this as well

Let me know if this helped

Nice looking website? haha... I only uploaded a few elements in order for this post - I'm not sure if you were just being silly when you said that...

I will play around and read up on your php reference... thanks...

As to the ardav - I'm not even sure you read my issue - if you looked at the example page I uploaded, you would see the drop down menu was all html-based, nothing generated... I think it's funny how some peoples' responses have absolutely nothing to do with the original post (and merely based upon a previous reply).

Member Avatar for diafol

As to the ardav - I'm not even sure you read my issue - if you looked at the example page I uploaded, you would see the drop down menu was all html-based, nothing generated... I think it's funny how some peoples' responses have absolutely nothing to do with the original post (and merely based upon a previous reply).

Listen buddy, I spent a good 5 minutes drawing up that code. The fact that your dropdown is all html doesn't mean that it wasn't generated dynamically by php. The fact that I mistook your intention is regrettable. As I have obviously wasted my time and yours, I won't make the same mistake again and risk a rude reply. If you had spent more time on DW, perhaps you'd notice that some of us are just here to help. Perhaps, I could have helped you with something in the future, however, you're now on my ignore list.

Member Avatar for ShandyElliott

Listen buddy, I spent a good 5 minutes drawing up that code. The fact that your dropdown is all html doesn't mean that it wasn't generated dynamically by php. The fact that I mistook your intention is regrettable. As I have obviously wasted my time and yours, I won't make the same mistake again and risk a rude reply. If you had spent more time on DW, perhaps you'd notice that some of us are just here to help. Perhaps, I could have helped you with something in the future, however, you're now on my ignore list.

Dually noted, buddy...

If you took the time to look more into my example, you wouldn't have wasted anyone's time thinking the drop menu was anything but html. The WHOLE question was how to pass a variable (which I figured would be through php code) - my post had nothing to do with whether my drop down was generated by php. Again, if you took a second to look at the example form, you wouldn't have wasted your precious 5 minutes writing code for which had nothing to do with my issue. It's not my fault you are too quick to misread my issue. The first replier certainly knew what I was asking. Don't get all pissy because I made comment that your reply didn't seem to have anything to do with anything I said. So, if you truly blocked me (which I doubt because I'm sure you are curious as to if I reply), go ahead and be a 12 year old. I just don't appreciate the few times I find myself having to rely on asking another for help to have someone not even take the time to read my issue and fire off some non-related code. Go bump up your "number of replies" to another post if you feel your time was wasted - again, not my fault. My reply wasn't meant to be rude - just making a statement that I know many people in forums share (but probably just keep it to themselves). I'm sure everyone appreciates another trying to help, but at least know what the poster is asking before anyone's time is wasted...

enuff said...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.