1
I use a select to access multiple sites example: city-1, city-2, city-3, when I select the city the url is: www.meusite.com.br/city-1. There I tried to use ajax to get the URL fixed on: www.meusite.com.br, but I was unsuccessful.
<?php
switch ($_GET['cidade']) {
case 'cidade-a':
header('Location: /seletor/cidade-1.php');
exit;
case 'cidade-b':
header('Location: /seletor/cidade-2.php');
exit;
case 'cidade-c':
header('Location: /seletor/cidade-3.php');
exit;
// default:
// header('Location: /seletor/index.php');
// exit;
} ?>
<form action="cid.php" method="get">
<select name="cidade" id="cidade">
<option>Selecione</option>
<option value="cidade-a">Cidade 1</option>
<option value="cidade-b">Cidade 2</option>
<option value="cidade-c">Cidade 3</option>
</select>
<input type="submit" name="submit" id="submit" class="botao" value="Ok">
</form>
I really appreciate anyone who can help me.
I couldn’t update the content without modifying the URL. Example: when selecting the city-1 continue with the URL: www.meusite.com.br instead of www.meusite.com.br/city-1.
– José Firmino
I want when selecting the city it takes the file of each city without changing the URL, because when it selects it is: www.meusite.com.br/city-1.php, city-2.php, city-3.php. I want him to take the respective content without having to show the URL of which city it is, because the name of the city will be in the HEADER of the site, similar system to this site: https://www.brisanet.com.br/home/
– José Firmino
I wanted to do the same as the site I sent over there on the breeze, the user selects the city and it shows the index content of the given city, not to have to show: city.php understands?
– José Firmino
Usually each city is a different value, are different plans and conditions, I will upgrade my intro for you to see.
– José Firmino
For you to better understand how it works I surpassed my code: http://connect.vaptsites.com.br
– José Firmino
I want to show the content of the city, without showing her name in the URL.
– José Firmino
I tested some cities of
Brisa Net
and all that tested is the same site, same content, same prices. But in your case you can add the value of the city in asession
or incookies
and then you can capture that value and use a class ofview
to display the contents of that city to the user. The advantage of usingsession
orcookies
, is that you can browse multiple pages and not necessarily a single page. Oh, and here’s a tip: Don’t use an 11MB image as a background.– Valdeir Psr
The breeze it changes the plans and values if you choose another state it will change. In my case is the same site also will only change some values
– José Firmino
The background image I put up just to test I will optimize it is reduce, there is somewhere where I can learn to use Ssion or cookies ?
– José Firmino
This... Then the user will already know the city because it will be on the menu, I made a map also that I will call with select, I’m only picking up on this redirect part that I never needed to use.
– José Firmino
That... 1 PHP file for each city, there is a better solution?
– José Firmino
Of course, only 1 file and you do GET to know what the name of the city was chosen
– Sam
If you have 100 cities you will make 100 php files?
– Sam
So that my GET is wrong, isn’t it? Because I put there to pull the PHP file of each city, however... It won’t be more than 10 cities I believe
– José Firmino
Could you help me solve this problem ? Because I’m totally lost. But you already gave me a north, very obg.
– José Firmino