Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 05-24-2004, 10:28 PM   #1
Registered: May 2003
Location: Somewhere over the Rainbow
Distribution: Slackware 9.x, Knoppix, Damn Small Linux, RedHat.
Posts: 465

Rep: Reputation: 30
PHP Pass Parameter

Hi I would like some help passing parameter. Currently I have a Drop Down Menu and I would like to pass the parameter that I choose from the Drop Menu. Like If I choose 'Testing' from Drop Menu pass that name into the URL.

Output: Ejecutar-Equipo.php?Name=Testing

Thanks a lot

<FORM NAME="frmMenu" OnSubmit="jumptourl()" action="Ejecutar-Equipo.php" method="get" >    
    <input name="txtUser" type="hidden" class="style3" value="<?php echo $User->userid;?>" size="40" maxlength="15">
    <SELECT NAME="Equipo"  OnChange="frmMenu.submit()">
    $link = OpenConnection();
      $result = mysql_query("SELECT * FROM MisEquipos WHERE username= '$txtUser'  ORDER BY 'sort' ASC");
        echo '<OPTION VALUE="">Escoja su Equipo...';
      while($row = mysql_fetch_array($result))
        /* display menu items  */
        $option =  "<option  value=\"".$row[campoalt]."\" />"."Nombre Equipo: ".$row[equipo]." ";
        echo ("".$option."");    
    <!-- <input name="txtUser" type="text" class="style3" value="<?php echo $row[0];?>" size="40" maxlength="15">  -->
    <SCRIPT LANGUAGE="JavaScript">
          function jumptourl()
            window.location = './index.php?m=' + frmMenu.Equipo'&s=0';
Old 05-25-2004, 07:28 AM   #2
Senior Member
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,548

Rep: Reputation: 136Reputation: 136
as far as i know the value of option tags is supposed to be a digit not a string but maybe someone else knows better. so u may read the campoalt-values into an array while looping thru the mysq_fetch_array and then take the keys of this array as value for the option tag.
buena suerte
Old 05-25-2004, 08:12 AM   #3
Registered: May 2004
Location: Montreal,QC,Canada
Distribution: Fedora Core 7
Posts: 210

Rep: Reputation: 30
Well you cant have both an action and a function wich do a window.location when submitting....

This will not work. simply rem the jumptour function and you should have the parm at Ejecutar-Equipo.php

<FORM NAME="frmMenu" onSubmit="jumptourl()" action="Ejecutar-Equipo.php" method="get" >

function jumptourl()
window.location = './index.php?m=' + frmMenu.Equipo'&s=0';

and for J-Ray, refering to W3C and HTML 4.0 specs:

Select option value = cdata [CS] This attribute specifies the initial value of the control.

CDATA is a sequence of characters from the document character set and may include character entities. User agents should interpret attribute values as follows:
Replace character entities with characters,
Ignore line feeds,
Replace each carriage return or tab with a single space.

So it can be almost anything :-)

Good Luck!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to pass command-line parameter to shell script? Kropotkin Linux - Newbie 12 07-25-2011 09:24 AM
gtk - How to pass in a parameter Ian D Programming 4 10-28-2005 11:23 AM
how do I pass a module parameter? maerong Debian 2 02-07-2005 07:33 AM
pass a parameter to a running program nimra Linux - Software 1 06-29-2004 01:38 AM
bash: pass a parameter to xview nimra Programming 2 06-28-2004 09:18 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:54 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration