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
https://forums.phpfreaks.com/topic/126695-solved-passing-variables/
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?

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>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.