Page 1 of 1

value from child page to mother

Posted: Thu Sep 01, 2005 4:45 am
by pleigh
i have a child code here

Code: Select all

//months array
	$months = array (1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
	
	//dropdown
	echo '<select name="startmonth">';
	echo "<option value=\"\">Month</option><br>";
	foreach ($months as $key => $value) 
	{
		echo "<option value=\"$key\">$value</option>\n";
	}
	echo '</select>
	<select name="startday">';
	echo "<option value=\"\">Day</option><br>";
	for ($day = 1; $day <= 31; $day++) 
	{
		echo "<option value=\"$day\">$day</option>\n";
	}
	echo '</select>
	<select name="startyear">';
	echo "<option value=\"\">Year</option><br>";
	$year = 2005;
	while ($year <= 2010) 
	{
		echo "<option value=\"$year\">$year</option>\n";
		$year++;
	}
	echo '</select>';
upon filling up the form(selecting the date), i want its value to pass to the mother page....i know it can be done through javascript but i have little knowledge of javascript...i hope you can help me guys...thanks in advance :)

( JAM | Moved )

Posted: Thu Sep 01, 2005 7:15 am
by n00b Saibot
What do you mean by child and mother ??? is the form inside an IFRAME ? or inside a different frame ?

Posted: Thu Sep 01, 2005 8:23 am
by s.dot
I'm guessing this should be in Client Side :P

Either way you need an event to trigger the passing to the parent page. Perhaps an onMouseOver or onChange in your select boxes. Then you'd pass the information to a function on the parent page.

Code: Select all

onChange="document.functionName('data');"

// Sample function

<script language="text/javascript">
<!--
function functionName(data)
{
   document.getElementById("date").innerHTML = '<p>'+date+'</p>';
}
//-->
Something along those lines. My javascript is scarce as well.