0

is it possible to generate a random number and then use cookies to pass this number to other page?

i cannot use session_start because it does not like my code for resizing the images that are uploaded and i cannot use get as the page the the random number is in a iframe and has no buttons on to append it to the url.

i have tried to post the data but had no joy the variable $rand has no value when checked on the next page. the code i used for the submit button looks like this

<form name="newad" method="post" enctype="multipart/form-data"  action="">
		<input type="hidden" method="<?=$rand;?>" name="rand" />
		<input type="file" name="broad1_image"  ></td></tr>
		<input name="Submit" type="submit" id="image1" value="Upload image" ></td></tr>
	
</form>

and the code i used to retrieve the value looks like this

$rand= $_POST['rand'];
3
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by ShawnCplus
0

Before the form you will need to generate the random number, also you have specified no value for the hidden field, change method= to value=.

To generate the random number do something like this:

<?
// mt_rand(min value, max value)
$rand = mt_rand();
?>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.