/    Sign up×
Community /Pin to ProfileBookmark

Undentified variable?

I have a problem with undefined variables…

In my index.php i have (opens a popup with a calendar)

<input type=”text” name=”ankomstdatum” size=”” value=”<?php echo $_SESSION[‘ankomstdatum’]; ?>”>
<input type=”button” onClick=’targetitem = document.forms[0].ankomstdatum; dataitem = window.open(“kalender.php”, “dataitem”, “toolbar=no,menubar=no,scrollbars=yes,width=1000,height=800″); dataitem.targetitem = targetitem’ value=”Välj ankomstdatum”>

in my kalender.php I have (javascript for returning date)

<script>
//Script för att returnera datum…
function select_item(item)
{
targetitem.value = item;
top.close();
return false;
}
</script>

and (the links for previous and next month)

<td width=”50%” align=”left”>&nbsp;&nbsp;<a href=”<?php echo $_SERVER[“PHP_SELF”] . “?month=”. $prev_month . “&year=” . $prev_year; ?>” style=”color:#FFFFFF” title=”Föregående månad”>F&ouml;reg&aring;ende</a></td>
<td width=”50%” align=”right”><a href=”<?php echo $_
SERVER[“PHP_SELF”] . “?month=”. $next_month . “&year=” . $next_year; ?>” style=”color:#FFFFFF” title=”Nästa månad”>N&auml;sta</a>&nbsp;&nbsp;</td>

and (the link in calendar with date to return)

echo “<a href=” onClick=’return select_item(“”.$newdate.””)’><td align=’left’ valign=’top’ style=’height:40px;’ width=’40’ title='”.$newdate.”‘>”.($i – $startday + 1) .”</a>”;

It works as long as I don’t change the month, if I do I get this

“Detaljerad information om felet på webbsidan

Användaragent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; GTB6.5; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)
Tidsstämpling: Thu, 26 Aug 2010 15:21:05 UTC

Message: ‘targetitem’ is undefined.
Row: 15
Character: 1
Code: 0
URI: http://www.briardliv.se/marcus/skola/php/projekt/kalender.php?month=9&year=2010

You can see all of it at [url]http://www.briardliv.se/marcus/skola/php/projekt/index.php[/url]

It’s in Swedish but the calendar is still understandable.

Cheers!

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @hjortsberg spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...