
Eoin
Members-
Posts
10 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
Eoin's Achievements

Newbie (1/5)
0
Reputation
-
Unfortunately not.the variable $desc is a variable from a different page which is being passed when the buildingClick() function is called.
-
i am having a problem passing variables from a php file to a html file using a javascript funtion. here is the code i have. /////////InteractiveMap.HTML//////////////////////////////////////////////////// <script type="text/javascript"> // This function is called when a building is clicked. function buildingClick(id,name,desc) { var mywin; var isOpen = false; var searchInt; var passVal; passVal = desc; mywin = window.location.href = "informationPage.html"; searchInt = setInterval(function(){if(isOpen){var display=mywin.document.getElementById("infoArea"); display.value = passVal;}});} /////////////////////////////////////////////////////////////////// ////////////InformationPage.html/////////////////////////////// <script type="text/javascript"> window.onload = function(){window.opener.window["isOpen"] = true;}; </script> <textarea disabled id="infoArea"></textarea> ////////////////////////////////////////////////////// I am just tryin to display the variable desc in the textarea "infoArea" but it wont work.Any help would be appreciated. eoin
-
i am having a problem passing variables from a php file to a html file using a javascript funtion. here is the code i have. /////////InteractiveMap.HTML//////////////////////////////////////////////////// <script type="text/javascript"> // This function is called when a building is clicked. function buildingClick(id,name,desc) { var mywin; var isOpen = false; var searchInt; var passVal; passVal = desc; mywin = window.location.href = "informationPage.html"; searchInt = setInterval(function(){if(isOpen){var display=mywin.document.getElementById("infoArea"); display.value = passVal;}});} /////////////////////////////////////////////////////////////////// ////////////InformationPage.html/////////////////////////////// <script type="text/javascript"> window.onload = function(){window.opener.window["isOpen"] = true;}; </script> <textarea disabled id="infoArea"></textarea> ////////////////////////////////////////////////////// I am just tryin to display the variable desc in the textarea "infoArea" but it wont work.Any help would be appreciated. eoin
-
I am trying to create a login page where i am comparing a username and a password from two text boxes to a username and a password field from a database. I am having trouble getting the database variables to do the comparison with. /////HTML/////////////////////////////////////////////////////////////////////////// User Name: <input id="UserBox" type="text" name="uname" /><br /> Password: <input id="PassBox" type="password" name="pname" /><br /> <input id="theButton" type="button" class="roundedClass" value="Login" onClick="passCheck()" /> /////////////////////////////////////////////////////////////////////////////////////// <script type="text/javascript"> function passCheck() { var u = document.getElementById("UserBox"); var p = document.getElementById("PassBox"); if (u.value == $username && p.value == $password) { window.location.href ='mainPage.html'; } else alert("Invalid username or password.\nPlease try again ."); } </script> ///////////////////////////////////////////////////////// <?php // Include file to Connnect to online database include_once "mysql_connect.php"; // Collects data from table $data = mysql_query("SELECT * FROM login") or die(mysql_error()); while($info = mysql_fetch_array( $data )){ $username=$info['username']; $password=$info['password']; } ?> my question is how can i gain access to $username and $password so they can be used in the passCheck() function as they wont work as above?any help would be appreciated. Eoin.
-
I have currently got a while loop retrieving the relevant data from a database and drawing polygons.On the polygon onClick()action a buildingClick function is called passing a few variables.in that buildingClick function i am trying to pass these variables to a new page to display in a text area but i cant get it to work.the new page opens but doesnt display the variables as intended. //////////////////////////////////////////////////////////////////////////////////////////////// EXTMAP.PHP <?php while($info = mysql_fetch_array( $data )){ $id = $info['id']; $name = $info['name']; $b_desc = $info['information']; echo "<polygon fill=".$info['fill_colour']." stroke=\"black\" onclick=\"buildingClick($id,'$name','$b_desc')\" points=".$info['coordinates']."/>"; } ?> ///////////////////////////////////////// <script type="text/javascript"> var mywin; var isOpen = false; var searchInt; var passVal; // This function is called when a building is clicked. function buildingClick(id,name,desc) { passVal = desc; mywin = window.location.href = "informationPage.html"; searchInt = setInterval(function(){if(isOpen){mywin.document.getElementById("infoArea").value = passVal; clearInterval(searchInt);}}, 100); } </script> ////////////////////////////////////////////////////////////////////////////////// INFORMATIONPAGE.HTML <script type="text/javascript"> window.onload = function(){window.opener.window["isOpen"] = true;}; </script> <div class="infoDiv" id=infoDiv> Name: <input type="text" disabled="true" id="bName" /> </div> ///////////////////////////////////////////////////////////////////////////////////// If anybody knows why this isnt working or ow i could make it work it would be much appreciated. Eoin.
-
At the moment i have a funtion buildingClick() that will work and output an id for each polygon i am drawing in the while loop.but if i pass more then one value from the onclick action it wont work. /////////////////////////////////////////////////////////////////////////// <?php while($info = mysql_fetch_array( $data )){ $id = $info['id']; $name = $info['name']; $b_desc = $info['information']; echo "<polygon fill=".$info['fill_colour']." stroke=\"black\" onclick=\"buildingClick($id,$name,$b_desc)\" points=".$info['coordinates']." />"; } ?> /////////////////////////////////////////////////////////////////////////// Function buildinClick : function buildingClick(id,name,desc) { alert(id + "" + name + "" + desc); } the points of interested are in bold. Any help would be great. Eoin.
-
I see.would you have any suggestions on what to do as i need to be able to pass in the id.
-
Firstly i am new to php.Iv currently got this while loop iterating through a database drawing polygons from the info in the datatable.each polygon has its own id stored in the datatable and with the on click event i am trying to just output to the screen the specific id of the polygon clicked on.It looks ok to me but it doesnt work for some reason. Below is the loop and the function it is trying to call. /////////////////////////////////////////////////////////////////////// <?php while($info = mysql_fetch_array( $data )){ echo "<polygon fill=".$info['fill_colour']." stroke=\"black\" id=".$info['id']." onclick=\"buildingClick(id)\" points=".$info['coordinates']." />"; } ?> ///////////THIS IS THE FUNCTION/////////////////////////// <?php function buildingClick($id) { echo "building id : {$id}"; } ?> /////////////////////////////////////////////////////////////////// If anyone could help it would be hugely appreciated. Eoin
-
Hi. I am having a problem with a php while loop.I am trying to draw a polygon using coordinates from a online data table called buildinglist.the loop is supposed to loop through each row drawing a polygon with each set of coordinates : <?php // Include file to Connnect to online database include_once "mysql_connect.php"; // Collects data from table $data = mysql_query("SELECT * FROM buildinglist") or die(mysql_error()); // puts the "buildinglist" info into the $info array // $info = mysql_fetch_array( $data ); ?> <!DOCTYPE HTML> <html> <head> <style type="text/css"> #theMap {background-image:url('MapImg.png'); } polygon:hover{fill:gold;} </style> <script type="text/javascript"> // This function is called when the lake is clicked. function buildingClick(<?php $id ?>) { // Display a fact. alert("<?php print $id; ?>"); } </script> </head> <body> <svg id="theMap" x="0" y="0" width="900" height="900"> <?php while($info = mysql_fetch_array( $data )){ //THE PROBLEM IS WITH THIS LINE// echo "<polygon fill="$info['fill_colour']" stroke="black" id="$info['id']" points="$info['coordinates']" />"; } ?> </svg> </body> </html> Can anybody help?it would be highly appreciated Eoin.