Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
hi,
I am having dropdown menu in my php script(prva.php). In another php script (vtora.php) I have the same drop down menu but the drop down menu shows the previously selected value from the drop down menu in prva.php(from the various values that are optional to select).
The problem that I have is that I want depending on the value from the drop down menu that was passed to vtora.php to select a table from my database.
The code for the drop down menu in prva.php is :Code: Select all
<form name="Meni" action="vtora.php" method="POST">
<tr>
<td width="44%" align="center" valign="top" bordercolor="#00FFFF" class="A-Text-BG" id="Recnik11_Td4">
<div align="right">
<p><span class="style5">ЈАЗИК</span>
<select name="Jazik" id="Jazik" style="width:25%;height:inherit" >
<option selected="selected" value="none"> </option>
<option value="me">Македонски-Англиски</option>
<option value="em">Англиски-Македонски</option>
<option value="md">Македонски-Германски</option>
<option value="dm">Германски-Македонски</option>
</select>
</p>
</div>
</td>
</tr>
</form>
<?php
The code for the drop down menu in vtora.php is :
<form method="post" action="vtora.php" >
<?php
if ($_POST["Jazik"] == "none"){echo "<option value='none' selected> </option>";}?>
<?php if ($_POST["Jazik"] == "me"){echo "<option value='me' selected> Mакедонски-Англиски </option>";}
else
{echo "<option value='me'> Mакедонски-Англиски </option>";} ?>
<?php if ($_POST["Jazik"] == "em"){echo "<option value='em' selected> Англиски-Македонски </option>";}
else
{echo "<option value='em'> Англиски-Македонски </option>";} ?>
<?php if ($_POST["Jazik"] == "md"){echo "<option value='md' selected> Македонски-Германски </option>";}
else
{echo "<option value='md'> Македонски-Германски </option>";} ?>
<?php if ($_POST["Jazik"] == "dm"){echo "<option value='dm' selected> Германски-Македонски </option>";}
else
{echo "<option value='dm'> Германски-Македонски </option>";} ?>
</select>
</div>
</form>
The code that I am using to select a table depending on the value that was passed to vtora.php(and that code doesn't seem to work ) is :
if ($_POST["Jazik"]=="me") {$tabela="ang_mak";}
else
{if ($_POST["Jazik"]=="em") {$tabela="mak_ang";}}
if ($_POST["Jazik"]=="md") {$tabela="ger_mak";}
else
{if ($_POST["Jazik"]=="dm") {$tabela="mak_ger";}}Thanks
Reply With Quote
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
[quote="[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1"][b]11.[/b] Please use proper, complete spelling when posting in the forums. AOL Speak, leet speak and other abbreviated wording can confuse those that are trying to help you (or those that you are trying to help). Please keep in mind that there are many people from many countries that use our forums to read, post and learn. They do not always speak English as well as some of us, nor do they know these aberrant abbreviations. Therefore, use as few abbreviations as possible, especially when using such simple words.
Some examples of what not to do are ne1, any1 (anyone); u (you); ur (your or you're); 2 (to too); prolly (probably); afaik (as far as I know); etc.[/quote]