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'];

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();
?>
<input type="hidden" value="<?=$rand ?>" name="rand" />

The method only applies to the form tag.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.