...

View Full Version : Passing Information over Link



Donno24
08-04-2008, 04:42 PM
Hi everyone,
I have a dropdown list in a page with a list of products, what I want to do is...

Have a link e.g. index.php?package=1PageWebsite in a page and I want it to pass through to another page with a dropdown list of products and have the package preselected on the dropdown list.

Is this possible??

Hope you can help,

Thanks
Donno24

mlseim
08-04-2008, 04:48 PM
Sure it's possible.

It would be best if you had a couple of web pages to show us (online).
One with the link, and the page that has the dropdown list.

That would give us a better idea of what you're doing.

The reason to see your page is that there are several ways of doing this,
but which one is best? Maybe we can answer it best if we see it.
It could be PHP, Javascripting, and/or both together (AJAX) ... also,
PHP SESSIONS might be used ... hard to answer right now.

Donno24
08-04-2008, 05:06 PM
Sorry I cannot give the website link out at present. But the link is just normal link, and the dropdown is from a page that has this link


orders/mod.php?mod=orders&ord_domain=hello&extension=.ie&Submit=Proceed

I dunno if this helps any, so sorry for being so vague.

derzok
08-04-2008, 05:17 PM
That depends on how the dropdown list is generated. If it's from an array in php, this will be very easy. Just compare $_GET['package'] to the current value of the <option> being printed. If it matches, add a 'selected="selected"' option inside of the tag. If it's not the same, display it like normal.

Some code I just finished writing the other day:



<select name="department">
<?php
foreach($departments as $key=>$myrow) {
echo ($myrow['id'] == $row['dep']) ? '<option value="'.$myrow['id'].'" selected="selected">'.$myrow['name'].'</option>' : '<option value="'.$myrow['id'].'">'.$myrow['name'].'</option>';
}
?>
</select>


More simplistically:


<select name="department">
<?php
foreach($departments as $key=>$myrow) {
if($myrow['id'] == $row['dep']) {
echo '<option value="'.$myrow['id'].'" selected="selected">'.$myrow['name'].'</option>';
} else {
echo '<option value="'.$myrow['id'].'">'.$myrow['name'].'</option>';
}
}
?>
</select>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum