View Full Version : using var got from another page when refreshing the new page

01-12-2012, 12:14 PM
Hi, I been trying everything,
I have on one page this code:
<option value="precios_propiedades_uno_test.php?property=<?=$row["property"]?>"><?=$row["property"]?></option>

This gives me from a mysql select a list of properties.
when I choose a property I am taken to another page and do get the var correctly like this:

On that page I am suppose to update prices for several seasons for the same property so I want the var every time I update and send the form, and then I need the var for the next update on that same page as refreshes using a header.

in the mysql select on the new page precios_propiedades_uno_test.php
I use this WHERE property = '$_GET[property]' and it works perfect

I added this to the form to get the var when I update:
<input type="text" name="property" value="<?php print($_GET['property']); ?>" /><br>
It print the property perfect,
however when I submit the form, nothing is inserted, and when the page refreshed using a header I have the var both in the url and in the form.
the mysql update is like this:
$query = mysql_query("UPDATE calendar_table SET startdate='$llegada', enddate='$salida'
WHERE cal_date='$llegada' and property='property'");

I tried to change to ='$_GET[property]' but it is just the same does, not insert anything, so something is wrong.

The header that is sent after the update that refreshes the page is like this:
header ("Location: precios_propiedades_uno_test.php?property=$property");

Thanks in advance,

01-12-2012, 01:52 PM
Puf, finally I managed, dont know why I had to do, but changing the name in the form and update query it works:
<input type="text" name="property2" value="<?php print($_GET['property']); ?>" /><br>