Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Apr 2011
    Posts
    36
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Use SSI to handle FORM data

    It seems what I am looking for should be rather simple yet after spending the entire afternoon searching I have yet to find an answer. Basically I have an shtml page with a simple form containing two fields that calls itself, e.g. action="", I am trying to use the data from the form fields to call a php script through SSI.

    Code:
    <div id="sm_form">
    <form action="" method="get">
    <table>
    <tr>
        <td class="right">
            Min:
        </td>
        <td class="left">
            <input type="text" name="min" value="1" onClick="this.value=''" size="8" />
        </td>
        <td class="right">
            Max:
        </td>
        <td class="left">
            <input type="text" name="max" value="64" onClick="this.value''" size="8" />
        </td>
    </tr>
    <tr>
        <td colspan="2" class="center">
            <input type="submit" name="submit" value="Submit" />
        </td>
        <td colspan="2" class="center">
            <input type="reset" />
        </td>
    </tr>
    </table>
    </form>
    </div>
    <div id="sm_out">
    <!--#include file="random.php?min=<MIN FIELD FROM FORM>&max=<MAX FIELD FROM FORM>" -->
    </div>
    The part that is getting me is how do I get the form data using just SSI. I can get the whole query string, everything after the ? in the url, but I need two different variables and it doesn't look like SSI does pattern matching.

  • #2
    New Coder
    Join Date
    Apr 2011
    Posts
    36
    Thanks
    0
    Thanked 3 Times in 3 Posts
    It would appear I was correct in that the resolution was simple. I was attempting to mask the form processing script from the user while including it's output in the html code, something very similar to an AJAX style request but not dependent on javascript or modifying the document. Everything in the sm_form div remains the same however the sm_out now looks like:

    Code:
    <div id="sm_out"><!--#set var="qstring" value="$QUERY_STRING" -->
    Query: <a title="Random String" href="./random.php?<!--#echo var="qstring" -->" rel="NOFOLLOW">./random.php?<!--#echo var="qstring" --></a>
    <br />
    <br />
    <!--#include virtual="random.php?${qstring}" -->
    </div>
    It can be seen in action at http://www.distortedperception.org/toolbox/random.html


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •