Forum Moderators: coopster
I'm trying to pass a variable, but for some reason it's not grabbing it. I'm sure it's something obvious, but I'm not able to track it down.
Here's the relevant code. What I'm trying to do is get the affiliate ID (affilID) in order to narrow the results of the query to the database. I've echoed out the variable but all it prints the variable name, not value. Thanks (as always) for any help with this.
<form name="form1" method="POST" action="<?php echo $_SERVER ['PHP_SELF'];?>">
<p>Please enter your Affiliate ID: <input name="affilID" type="text" id="affilID"></p>
<p>Select Date Range:</p>
<p><input type="radio" name="whichrange" value="1" checked> From
<select name="from1">
<option value="Select Date" selected>--Select Date</option>
<option value="2004-12-01 00:00:00">2004-12-01</option>
<option value="2005-01-01 00:00:00">2005-01-01</option>
<option value="2005-02-01 00:00:00">2005-02-01</option>
<option value="2005-03-01 00:00:00">2005-03-01</option>
<option value="2005-04-01 00:00:00">2005-04-01</option>
<option value="2005-05-01 00:00:00">2005-05-01</option>
<option value="2005-06-01 00:00:00">2005-06-01</option>
</select>
to
<select name="to1">
<option value="Select Date" selected>--Select Date</option>
<option value="2004-12-31 23:59:59">2004-12-31</option>
<option value="2005-01-31 23:59:59">2005-01-31</option>
<option value="2005-02-28 23:59:59">2005-02-28</option>
<option value="2005-03-31 23:59:59">2005-03-31</option>
<option value="2005-04-30 23:59:59">2005-04-30</option>
<option value="2005-05-31 23:59:59">2005-05-31</option>
<option value="2005-06-30 23:59:59">2005-06-30</option>
</select> </p>
<p>or enter dates in the format of yyyy-mm-dd:</p>
<p><input type="radio" name="whichrange" value="2"> From:
<input name="from2" type="text" id="from2">
to
<input name="to2" type="text" id="to2">
</p>
<p>
<input type="submit" name="Submit" value="View Sales">
<input type="reset" name="Submit2" value="Reset">
</p>
</form>
<?php
} else {
// form has been submitted
// create short variable names
$affilID = $_POST['affilID'];
echo '$affilID';
Here's what it prints:
$affilID
echo '$affilID';
You want:
echo $affilID;
echo '$affilID is '.$affilID;
<edit>Smad: Jinx!</edit>