Jump to content

[SOLVED] Passing Variables


phatgreenbuds

Recommended Posts

Consider the code below. How would I pass both the "$tblname" and "$display" through in the POST method?  Yes there is a bit of scripting before this that dynamically pulls the values for each and I need to somehow get them POST'd to the next step. Also is there anyway to do this without the need for a submit button? I have seen sites before that change the moment you change the selection and I cannot seem to figure out how to do that.

 

<form action="<?php $_PHP_SELF ?>" method="POST">
    <select name="table" size="1">		
            <option value="<?php echo $tblname ?>"><?php echo $display ?></option>
    </select>
    <input type="submit" name="submit" value="Submit">
</form>

Link to comment
Share on other sites

There is the value that is the actual table name and not exactly user-friendly something like blah_9_30_08. Then the correlating display to reference that table that is user-friendly like Sept 30th, 2008. Thus the two variables $tblname and $display. 

 

There are 14 of these combinations that can be selected and there is a new one added each day and an old one deleted everyday thru another automated script.

 

In order to start using this I want to pass both variables to the next page. I can pass the one as the value but how would I pass the other which is traditionally a display name in the drop down? Is that even possible using a drop down?

Link to comment
Share on other sites

hmm...if there's a different $tblname $display combo for each choice then only thing I can really think of is to first create a multidim array and pass a whole array as a value. Example:

 

$data[0] = array ('tblname' => $tblname, 'display' => $display);
.
.
.
<option value = '{$data[0]}'>whatever</option>

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.