I have a php page to update records of a table.


There are two fields that are used to relate to other tables reason why they
are like list/menu.



The problem is that these "select" must show the list to me of elements of
the table that contains the data but the selected value must update the
table for which I am created the update form. Example:



Persons (id_person, id_country, id_city, name, last_name)



Country (id_country, country)



City (id_city, City)



Therefore in the update page they are to the fields of the Persons table:



< input type="text" name = "id_person " value="<?php I throw $$row>_ persons
[ ' id_person ' ]; > " >

< input type="text" name = "name" value="<?php I throw $$row>_ persons [ '
name ' ]; > " >



Etc.



Now the instruction select must be declared of the following form:



<select name="id_country">

<?php

do {

?>

<option value="<?= $row_ country ['id_ country ']?>" <?php if
(!(strcmp($row_ country ['id_ country '], "$row_persons['id_ country ']")))
{echo "SELECTED";} ?>><?= $row_ country [' country ']?></option>

<?php

} while ($row_ country = mysql_fetch_assoc($country));

?>

</select>



this works perfectly. Where:



<?php if (!(strcmp($row_ country ['id_ country '], "$row_persons['id_
country ']"))) {echo "SELECTED";} ?>



it is the sentence that verifies if the Persons  table has an equal value to
the registry of select. The same select for the case of the field would
happen to create another one "id_city". Then; when I create select dynamic
for the field "id_city", the servant shows an error to me where he says:
(the servant cannot use another behavior of servant. already there is a
behavior of used servant) and the page in target remains.



If exempt the sentence: <?php if (!(strcmp($row_ country ['id_ country '],
"$row_persons['id_ country ']"))) {echo "SELECTED";} ?>  From "select", one
becomes to show page, but clear that then it does not show the value to me
that has the Persons  table  in those specific fields, but that are the list
simply.



Somebody knows because it does not allow me to have but of a dynamic
list/menu in a page?



I hope to me to have explained more clearly possible so that they can give
some aid me





Greetings



Sorry, my English is poor, very.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to