Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Post variable from URL

Status
Not open for further replies.

AP81

Programmer
Apr 11, 2003
740
AU
Hi,

Is there any way you can post a variable from a URL?

e.g, if you look at my code below, every row in my table contains a column with a link:
\t\t<td><a href='find_action.php?DATENUM=$col_value'>$col_value</a></td>\n
I want to pass the DATENUM variable to find_action.php. Is it possible to post this without using a form? Otherwise if I am to use a form, how would I achive this?

Thanks in advance.
Code:
    	$rownum = 1;

	while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
		
		if (IsEven($rownum) == 1) 
		{
		$colour = "#FFFF99";
		} else {
		$colour = "#FFFFFF";
		} 
		
		echo "\t<tr bgcolor=$colour>\n";
		echo "<td><span class='style3'><b>$rownum</b></span></td>";  	
		foreach ($line as $col_name=>$col_value) {
			if ($col_name == "DATENUM") {
				echo "\t\t<td><a href='find_action.php?DATENUM=$col_value'>$col_value</a></td>\n";
			}	
			else {
				echo "\t\t<td><span class='style3'>$col_value</span></td>\n";
			}
		}
		echo "\t</tr>\n"; 
		$rownum++;
	}	
}
echo "</table>\n";
echo "</div>";
}




------------------------------------
There's no place like 127.0.0.1
------------------------------------
 
The find_action is already the form of yours.

With the type of URL, you will need this:

find_action.php?DATENUM=$col_value

in the find_action.php:

$datenum = $_GET["DATENUM"];
 
Thanks mate




------------------------------------
There's no place like 127.0.0.1
------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top