Page 1 of 1

URL Updating

Posted: Sun Apr 10, 2011 6:33 pm
by Sank.Senathirajah
Hi

I have a select list on my form as the following

<form name="source_form">
<select id="sel_source_zero" name="sel_source_zero">
<?php
$sources = _ajax_get_news_sources();
foreach ($sources as $key => $value) {
print ("<option value=\"$key\">$value</option>\n");
}
?>
</select>
<input type="submit" value="Submit" />
</form>

When the user selects a value from the list, I want to take that value and pass it into a PHP function and return a list of IDs. Once I have the source value and the IDs, I want to update my URL with those values. My entire code is as follows

<?php
$source_var = $_GET['sel_source_zero'];
$action_zero = "/news/date/"._ajax_condition_ids_final_unique_plus_seperated($source_var)."/$source_var";
?>

<script type="text/javascript">
$("#sel_source_zero").change(function (){
$.ajax()
});
</script>

<form name="source_form" method="get">
<select id="sel_source_zero" name="sel_source_zero">
<?php
$sources = _ajax_get_news_sources();
foreach ($sources as $key => $value) {
print ("<option value=\"$key\">$value</option>\n");
}
?>
</select>
<input type="submit" value="Submit" />
</form>

I have approached this problem by first trying to store the selected value ($("sel_source_zero").value()) into a PHP variable using AJAX. This is where I got stuck. I am trying to use $.ajax() function from jQuery appended to Drupal, but I'm not sure how to approach this. If I can some how store the JavaScript variable into PHP variable then I will be able to use my new converted to PHP source variable and pass that into my function to get the list of IDs and then update my URL. But I'm not even sure if this is the right approach. If anyone can point me in the right direction to how I can update my URL with the selected value and returned PHP values returned from a function that uses the selected value as it's parameter, I would greatly appreciate it.

Re: URL Updating

Posted: Mon Apr 18, 2011 7:44 am
by spencuier
yeah this is important information for me,nice topic.

Re: URL Updating

Posted: Wed Apr 20, 2011 7:06 am
by crienshauw
I have changed my own webpage's address several times over the course of the past 10 years, but old links still appear in several search engines. I need to know how to update them in search engines.
Paint Zoom

Re: URL Updating

Posted: Thu Apr 21, 2011 2:59 am
by eivind
crienshauw wrote:I need to know how to update them in search engines.
You need to do 301 redirects: http://tinyurl.com/3besjzd

Re: URL Updating

Posted: Tue Apr 26, 2011 1:14 am
by zoe1adela
301 links mean redirect to ,you should change your links simple.our website also happen this, i have solve it as this. :) wish you!

Re: URL Updating

Posted: Tue Apr 26, 2011 3:44 am
by Bogardussmith
How to update the URL Link?