You are here: Re: Help Please « PHP Programming Language « IT news, forums, messages
Re: Help Please

Posted by shimmyshack on 06/15/07 01:44

On Jun 15, 12:21 am, jsd219 <i...@musiclanerecording.com> wrote:
> I am going crazy over here. here is my code:
>
> $query = "SELECT SEC_TITLE, SEC_ID
> FROM section
> WHERE SEC_TITLE != ''";
>
> $result = mysql_query($query);
>
> echo "<form action='#'>\r\n<select name='id'>";
> while ($line = mysql_fetch_array($result, MYSQL_NUM)) {
> $section = $line[0];
> $id = $line[1];
>
> //echo " <option value=$section>$section\r\n";
>
> echo " <option value='$id'>$section</option>\n";
>
> }
>
> I need to pull both a name=id & name=section. and then send both via
> the option value. What this does is it pulls all the section titles
> for the table section and places them into a drop down box, when you
> select one of the sections and send the form it places that section
> title in the section field of the category table. i need it to not
> only send the section title but also the section id to the id field of
> the category table.
>
> I am at a complete loss, Please someone help me
>
> God bless
> jason


just combine both id and section into a single variable!

echo '<form method="get">';
echo '<select name="combined">';
echo ' <option value="'.$id.'|'.$section.'">$section</option>'."\n";
#etc...
echo '</select>';
echo '</form>';


<?php

if( isset($_GET['combined'] && ($_GET['combined']!='') )
{
$arrayIdAndSection = explode( '|', $_GET['combined'] );
$id = $arrayIdAndSection[0];
$section = $arrayIdAndSection[1];
}

?>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация