Jump to content

Recommended Posts

[img src=\"style_emoticons/[#EMO_DIR#]/huh.gif\" style=\"vertical-align:middle\" emoid=\":huh:\" border=\"0\" alt=\"huh.gif\" /]
First of all: I am Austrian and my English is bad for sure. I apologize, but I try.
Second: on behalf of PHP I am a newbie. Do not have probs with databases (normally).

What I am trying to do:
I would like to generate a filter for database sql script (which is no prob for me); this filter is a dynamic dropdown (I THINK, this is no problem for me), which should react on user action. Oh - You guess right - now my problem begins.

It would be good, to get rid of all javascript-parts, as some guys do have javascript off (as I do, for instance [img src=\"style_emoticons/[#EMO_DIR#]/wink.gif\" style=\"vertical-align:middle\" emoid=\":wink:\" border=\"0\" alt=\"wink.gif\" /] ).

In a later version I will make this page available for a choice of database-lists.

[code]
<?php
    session_start(); #normal php start
#here I guess a possible creation or passing of the subquery-Part
    if (isset($_SESSION['subquery'])) {
    
        $_SESSION['subquery'] = $_SESSION['subquery'].' testet';
        echo "<a href='option_select.php?filter='".$supquery.">filtertest</a>";
    }
    ?>
<html>
<head>
<title>Dynamic Choice</title>
</head>
<body>
# here I would like to give You an idea, how I would create the filters;
# the main part of the query is of the sort "SELECT * FROM xtable"
<script language="javascript" type="text/javascript">
    function process(Filter)
    {
        if (Filter=="FN") {
        subquery=" ORDER BY Name";        
        }
        if (Filter=="FP") {
        subquery=" ORDER BY PLZ";
        }
        //und so weiter
        Filter = subquery;
        //location.reload();
    }
</script>

  <?php
# here i tried to find out, if the $Filtertext got some value; will be cleaned off
      if (!empty($_SESSION['$Filtertext'])) {
        $_SESSION['$Filtertext']="neu";
    }
      echo $Filtertext; ?>
      <p>
# Filter- or orderby part
    <?php
    $filterarten = array(
        "FL"=>"",
           "FN"=>"Familienname",
        "FP"=>"Postleitzahl",
        "FR"=>"Fachrichtung",
        "FM"=>"Mitglieder",
        "FI"=>"Mitglieder Inland",
        "FA"=>"Mitglieder Ausland",
        "FE"=>"Ehrenmitglieder",
        "FD"=>"Diplomierte"
        );
      ?>
    <form name="filterform" action=<?php echo $_SERVER['PHP_SELF']; ?> method="post" >      
    <select name="Filter[]" size="1" onChange="process(<?php echo $element ?>)">

    <?php
        foreach ($filterarten as $key=>$element) {
        echo "<option value=$key>$element</option>";
        }
      ?>
    </select>
      </p>
    <p>
        <input type="submit" name="Submit" value="Submit">
      </p>
    </form>

# again - I try to find out, is there anything, anyone - hallo????
<?php
    if ($filter) {
        echo "following filter was choiced:<br>";
        foreach($filter as $element) {
            echo "$element<br>";
        }
    }
    echo "$Filter<br>";
#here always the last element is shown. But is clear to me. Just for test if ANYTHING is writte by this program.
    echo "$element<br>";
?>
</body>
</html>
[/code]

I am thankfull for every hint.

I want to get rid of the submit-knob - as I mentioned before.
Thanks for reading, thanks for hopefully helping.

Henry
Link to comment
https://forums.phpfreaks.com/topic/11767-solved-dynamic-self-call/
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.