...

View Full Version : Use SSI to handle FORM data



munkeyboy
04-05-2011, 12:12 AM
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.



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

munkeyboy
04-05-2011, 10:28 PM
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:



<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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum