cooldude832 Posted January 2, 2010 Share Posted January 2, 2010 So I have this bit of code that pulls content into a center column (You can see it working kseego.com click the left column) and I am trying to setup an array of values in the called php script so they are set in the parent document so I can access them. The bit of code does this <?php if(mysql_num_rows($r) >0){ echo "<script type=text/javascript'>"; echo "var events_ids=new Array();"; echo "var events_dates=new Array();"; echo "var events_cats=new Array();"; echo "var events_open=new Array();"; echo "</script>"; $i = 0; while($row = mysql_fetch_assoc($r)){ write_ebox($row['EventID'],$row['ImageID'],$row['Ext'],$row['Title'],$row['StartDate'],$row['UserID'],$row['Poster'],$row['StartTime'], $row['EndTime'],$i,$row['CatID']); $i++; } } ?> In the write_ebox function I populate those 4 arrays with values using <?php echo "<script type=text/javascript'>"; echo "events_ids[".$i."]='event_div_".$id."'"; echo "events_dates[".$i."]='".date('j',strtotime($date))."'"; echo "events_cats[".$i."]='".$cat."'"; echo "events_open[".$i."]=0"; echo "</script>"; ?> However when I look in firebug I don't see those arrays even showing up any ideas on how to do this? Link to comment https://forums.phpfreaks.com/topic/186962-setting-up-javascript-variables-in-the-parent-window-in-a-content-area-pulled-in/ Share on other sites More sharing options...
cooldude832 Posted January 2, 2010 Author Share Posted January 2, 2010 I did a work around putting the content in a hidden div not pretty but worked Link to comment https://forums.phpfreaks.com/topic/186962-setting-up-javascript-variables-in-the-parent-window-in-a-content-area-pulled-in/#findComment-987324 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.