i have this code

<body>
<?php
	include 'cms/core/config.php';
	include 'cms/core/opendb.php';

$query = "SELECT id, language,  updated ". "FROM meta ". "WHERE id = '5'";
$result = mysql_query($query) or die('Error : ' . mysql_error());
list($id, $language, $updated) = mysql_fetch_array($result, MYSQL_NUM);

	include 'cms/core/closedb.php';
?>
<form method="post" action="default.php?s=editmeta">
<input type="hidden" name="id" value="5">
  <table width="700" border="0" cellpadding="5" cellspacing="0" class="box">
    <tr> 
      <td width="100" valign="top">Language:</td>
      <td>
	<select name='language' id="language" >
	<option value="bg">Bulgarian</option>
	<option value="cs">Czech</option>
	<option value="da">Danish</option>
	<option value="de">German</option>
	<option value="el">Greek</option>
	<option value="en" selected>English</option>
	<option value="en-gb">English (UK)</option>
	<option value="en-us">English (US)</option>
	<option value="es">Spanish</option>
	<option value="fi">Finnish</option>
	<option value="hr">Croatian</option>
	<option value="it">Italian</option>
	<option value="fr">French</option>
	<option value="fr-ca">French (Quebec)</option>
	<option value="ja">Japanese</option>
	<option value="ko">Korean</option>
	<option value="nl">Dutch</option>
	<option value="no">Norwegian</option>
	<option value="pl">Polish</option>
	<option value="ru">Russian</option>
	<option value="sv">Swedish</option>
	<option value="zh">Chinese</option>
    </select>    </td>
    </tr>
    <tr>  
      <td colspan="2" align="center"><input name="update" type="submit" id="update" value="Update Content"></td>
    </tr>
  </table>
</form>
</body>
</html>

basically before this page i have another to post your selected language to the db. the page pasted below is the edit page where you can you can change your language. what i want is that if in the first page you choose danish for instance and then you want go to change it at al later time it remembers that you had choosen danish.

i think i had found a script but couldnt understand how to implement it as im still green in php the script im talking about is in the following:

<?php 
$link=mysql_pconnect("localhost","user","password"); 
mysql_select_db("db",$link); 
$result = mysql_query("select date_format(birth_date,'%Y') as birth_year from members where member_id=1"); 

$row=mysql_fetch_array($result); // fetch first row 
$year=$row["birth_year"]; // retrieve 4-digit year of birth 

// display combo: current year -> -100 
$current_year=date("Y"); 
echo '<select name="cbo_year">'; 
for ($i = $current_year; $i >= ($current_year-100); $i--) { 
echo '<option '.($year == $i ? ' selected ' : '').' value="'.$i.'" >'.$i.'</option>'; 
} 
echo '</select>'; 
?>

just for you to know the table name is meta and the field is language. i will be glad if somebody help me out as im really stuck on this one! thanks alot in advance guys!

I hope this example will give you a better idea.

<html>
<body>
<form method="post" name="form1">
<select name="location">
<option value="city1" <?php if($_REQUEST['location']=="city1") { echo "selected"; }?>>City1</option>
<option value="city2" <?php if($_REQUEST['location']=="city2") { echo "selected"; }?>>City2</option>
<option value="city3" <?php if($_REQUEST['location']=="city3") { echo "selected"; }?>>City3</option>
<option value="city4" <?php if($_REQUEST['location']=="city4") { echo "selected"; }?>>City4</option>
<option value="city5" <?php if($_REQUEST['location']=="city5") { echo "selected"; }?>>City5</option>
</select>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>

I hope this example will give you a better idea.

<html>
<body>
<form method="post" name="form1">
<select name="location">
<option value="city1" <?php if($_REQUEST['location']=="city1") { echo "selected"; }?>>City1</option>
<option value="city2" <?php if($_REQUEST['location']=="city2") { echo "selected"; }?>>City2</option>
<option value="city3" <?php if($_REQUEST['location']=="city3") { echo "selected"; }?>>City3</option>
<option value="city4" <?php if($_REQUEST['location']=="city4") { echo "selected"; }?>>City4</option>
<option value="city5" <?php if($_REQUEST['location']=="city5") { echo "selected"; }?>>City5</option>
</select>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>

:)

<body>
<?php
	include 'cms/core/config.php';
	include 'cms/core/opendb.php';

$query = "SELECT id, description, keywords, author, language, rating, classification, distribution, robots, revisit, copyright, email, updated ". "FROM meta ". "WHERE id = '7'";
$result = mysql_query($query) or die('Error : ' . mysql_error());
list($id, $description, $keywords, $author, $language, $rating, $classification, $distribution, $robots, $revisit, $copyright, $email, $updated) = mysql_fetch_array($result, MYSQL_NUM);


	include 'cms/core/closedb.php';
?>
<form method="post" action="default.php?s=editmeta">
<input type="hidden" name="id" value="5">
  <table width="700" border="0" cellpadding="5" cellspacing="0" class="box">
<tr> 
      <td width="100" valign="top">Description:</td>
      <td><input name="description" type="text" id="description" value="<?=$description;?>" size="100"></td>
    </tr>
    <tr> 
      <td width="100" valign="top">Keywords:</td>
      <td><input name="keywords" type="text" id="keywords" value="<?=$keywords;?>" size="100"></td>
    </tr>
    <tr> 
      <td width="100" valign="top">Author:</td>
      <td><input name="author" type="text" id="author" value="<?=$author;?>" size="100"></td>
    </tr>
    <tr> 
      <td width="100" valign="top">Language:</td>
      <td>
	<select name='language' id="language" >
<option value="en" <?php if($_REQUEST['$language']=="en") { echo "selected"; }?>>English</option>
<option value="ko" <?php if($_REQUEST['$language']=="ko") { echo "selected"; }?>>Korean</option>
<option value="it" <?php if($_REQUEST['$language']=="it") { echo "selected"; }?>>Italian</option>
    </select>    
    </td>
    </tr>
    <tr> 
      <td width="100" valign="top">Rating:</td>
      <td>
	<select name="rating" id="rating">
	<option value="general">general</option>
	<option value="mature">mature</option>
	<option value="restricted">restricted</option>
	</select>
      </td>
    </tr>
    <tr> 
      <td width="100" valign="top">Classification:</td>
      <td><input name="classification" type="text" id="classification" value="<?=$classification;?>" size="100"></td>
    </tr>
    <tr> 
      <td width="100" valign="top">Distribution:</td>
      <td>
    <select name="distribution" id="distribution">
    <option value="global">global</option>
    <option value="local">local</option>
    <option value="iu">internal use</option>
    </select>
      </td>
    </tr>
    <tr> 
      <td width="100" valign="top">Robots:</td>
      <td>
    <select name="robots" id="robots">
    <option value="index, follow">index, follow</option>
    <option value="noindex, nofollow">noindex, nofollow</option>
    </select>
      </td>
    </tr>
    <tr> 
      <td width="100" valign="top">Revisit After:</td>
      <td>
    <select name="revisit" id="revisit">
    <option value="7 days">7 days</option>
    <option value="14 days">14 days</option>
    <option value="30 days">30 days</option>
    <option value="60 days">60 days</option>
    </select>
      </td>
    </tr>
    <tr> 
      <td width="100" valign="top">Copyright:</td>
      <td><input name="copyright" type="text" id="copyright" value="<?=$copyright;?>" size="100"></td>
    </tr>
    <tr> 
      <td width="100" valign="top">Email:</td>
      <td><input name="email" type="text" id="email" value="<?=$email;?>" size="100"></td>
    </tr>
    <tr>  
      <td colspan="2" align="center"><input name="update" type="submit" id="update" value="Update Content"></td>
    </tr>
    <tr> 
      <td colspan="2"><p align="center"><a href="javascript:history.back();">cancel and go back</a></p></td>
    </tr>
  </table>
</form>
</body>
</html>

the above the my code updated with your script, still nothing. maybe i integrated wronly ? i dont know ?! just yo let you know the language field name is "language" and in id row 7 corrently there is ko so it suppose to show korean selected but still nothing :(

Its not $_REQUEST , but, $_REQUEST.

did it as you told me bro

you can have a look at it here

still nothing. full code as it is now:

<body>
<?php
	include 'cms/core/config.php';
	include 'cms/core/opendb.php';

$query = "SELECT id, description, keywords, author, language, rating, classification, distribution, robots, revisit, copyright, email, updated ". "FROM meta ". "WHERE id = '7'";
$result = mysql_query($query) or die('Error : ' . mysql_error());
list($id, $description, $keywords, $author, $language, $rating, $classification, $distribution, $robots, $revisit, $copyright, $email, $updated) = mysql_fetch_array($result, MYSQL_NUM);

?>
<form method="post" action="default.php?s=editmeta">
<input type="hidden" name="id" value="5">
  <table width="700" border="0" cellpadding="5" cellspacing="0" class="box">
<tr> 
      <td width="100" valign="top">Description:</td>
      <td><input name="description" type="text" id="description" value="<?=$description;?>" size="100"></td>
    </tr>
    <tr> 
      <td width="100" valign="top">Keywords:</td>
      <td><input name="keywords" type="text" id="keywords" value="<?=$keywords;?>" size="100"></td>
    </tr>
    <tr> 
      <td width="100" valign="top">Author:</td>
      <td><input name="author" type="text" id="author" value="<?=$author;?>" size="100"></td>
    </tr>
    <tr> 
      <td width="100" valign="top">Language:</td>
      <td>
	<select name='language' id="language" >
<option value="en" <?php if($_REQUEST['language']=="en") { echo "selected"; }?>>English</option>
<option value="ko" <?php if($_REQUEST['language']=="ko") { echo "selected"; }?>>Korean</option>
<option value="it" <?php if($_REQUEST['language']=="it") { echo "selected"; }?>>Italian</option>
    </select>    
    </td>
    </tr>
    <tr> 
      <td width="100" valign="top">Rating:</td>
      <td>
	<select name="rating" id="rating">
	<option value="general">general</option>
	<option value="mature">mature</option>
	<option value="restricted">restricted</option>
	</select>
      </td>
    </tr>
    <tr> 
      <td width="100" valign="top">Classification:</td>
      <td><input name="classification" type="text" id="classification" value="<?=$classification;?>" size="100"></td>
    </tr>
    <tr> 
      <td width="100" valign="top">Distribution:</td>
      <td>
    <select name="distribution" id="distribution">
    <option value="global">global</option>
    <option value="local">local</option>
    <option value="iu">internal use</option>
    </select>
      </td>
    </tr>
    <tr> 
      <td width="100" valign="top">Robots:</td>
      <td>
    <select name="robots" id="robots">
    <option value="index, follow">index, follow</option>
    <option value="noindex, nofollow">noindex, nofollow</option>
    </select>
      </td>
    </tr>
    <tr> 
      <td width="100" valign="top">Revisit After:</td>
      <td>
    <select name="revisit" id="revisit">
    <option value="7 days">7 days</option>
    <option value="14 days">14 days</option>
    <option value="30 days">30 days</option>
    <option value="60 days">60 days</option>
    </select>
      </td>
    </tr>
    <tr> 
      <td width="100" valign="top">Copyright:</td>
      <td><input name="copyright" type="text" id="copyright" value="<?=$copyright;?>" size="100"></td>
    </tr>
    <tr> 
      <td width="100" valign="top">Email:</td>
      <td><input name="email" type="text" id="email" value="<?=$email;?>" size="100"></td>
    </tr>
    <tr>  
      <td colspan="2" align="center"><input name="update" type="submit" id="update" value="Update Content"></td>
    </tr>
    <tr> 
      <td colspan="2"><p align="center"><a href="javascript:history.back();">cancel and go back</a></p></td>
    </tr>
  </table>
</form>
<? 	include 'cms/core/closedb.php'; ?>
</body>
</html>

dont know why its not working it seems to be good

I totally misunderstood your question. I thought you wanted to display selected dropdown list value after submitting the page. But anyway, try this one.

<body>
<?php
	include 'cms/core/config.php';
	include 'cms/core/opendb.php';

$query = "SELECT id, description, keywords, author, language, rating, classification, distribution, robots, revisit, copyright, email, updated FROM meta WHERE id = '7'";
$result = mysql_query($query) or die('Error : ' . mysql_error());
list($id, $description, $keywords, $author, $language, $rating, $classification, $distribution, $robots, $revisit, $copyright, $email, $updated) = mysql_fetch_array($result, MYSQL_NUM);

?>
<form method="post" action="default.php?s=editmeta">
<input type="hidden" name="id" value="5">
  <table width="700" border="0" cellpadding="5" cellspacing="0" class="box">
<tr> 
      <td width="100" valign="top">Description:</td>
      <td><input name="description" type="text" id="description" value="<?=$description;?>" size="100"></td>
    </tr>
    <tr> 
      <td width="100" valign="top">Keywords:</td>
      <td><input name="keywords" type="text" id="keywords" value="<?=$keywords;?>" size="100"></td>
    </tr>
    <tr> 
      <td width="100" valign="top">Author:</td>
      <td><input name="author" type="text" id="author" value="<?=$author;?>" size="100"></td>
    </tr>
    <tr> 
      <td width="100" valign="top">Language:</td>
      <td>
	<select name='language' id="language" >
<option value="en" <?php if($language=="en") { echo "selected"; }?>>English</option>
<option value="ko" <?php if($language=="ko") { echo "selected"; }?>>Korean</option>
<option value="it" <?php if($language=="it") { echo "selected"; }?>>Italian</option>
    </select>    
    </td>
    </tr>
    <tr> 
      <td width="100" valign="top">Rating:</td>
      <td>
	<select name="rating" id="rating">
	<option value="general">general</option>
	<option value="mature">mature</option>
	<option value="restricted">restricted</option>
	</select>
      </td>
    </tr>
    <tr> 
      <td width="100" valign="top">Classification:</td>
      <td><input name="classification" type="text" id="classification" value="<?=$classification;?>" size="100"></td>
    </tr>
    <tr> 
      <td width="100" valign="top">Distribution:</td>
      <td>
    <select name="distribution" id="distribution">
    <option value="global">global</option>
    <option value="local">local</option>
    <option value="iu">internal use</option>
    </select>
      </td>
    </tr>
    <tr> 
      <td width="100" valign="top">Robots:</td>
      <td>
    <select name="robots" id="robots">
    <option value="index, follow">index, follow</option>
    <option value="noindex, nofollow">noindex, nofollow</option>
    </select>
      </td>
    </tr>
    <tr> 
      <td width="100" valign="top">Revisit After:</td>
      <td>
    <select name="revisit" id="revisit">
    <option value="7 days">7 days</option>
    <option value="14 days">14 days</option>
    <option value="30 days">30 days</option>
    <option value="60 days">60 days</option>
    </select>
      </td>
    </tr>
    <tr> 
      <td width="100" valign="top">Copyright:</td>
      <td><input name="copyright" type="text" id="copyright" value="<?=$copyright;?>" size="100"></td>
    </tr>
    <tr> 
      <td width="100" valign="top">Email:</td>
      <td><input name="email" type="text" id="email" value="<?=$email;?>" size="100"></td>
    </tr>
    <tr>  
      <td colspan="2" align="center"><input name="update" type="submit" id="update" value="Update Content"></td>
    </tr>
    <tr> 
      <td colspan="2"><p align="center"><a href="javascript<b></b>:history.back();">cancel and go back</a></p></td>
    </tr>
  </table>
</form>
<? 	include 'cms/core/closedb.php'; ?>
</body>
</html>

Oh btw, Don't use <? [short tags]. Its disabled on most of the servers by default.

no worries man, made changes works like good :D thanks alot for your help bro

print_r(array(0,1,2));

what does that mean ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.