2013-11-26 1 views
0

정의되지 않은 ID로 문제를 해결하려고 시도했지만 시도 할 수 없습니다. 내가 ID를 정의되지 않은했지만 내가 사용하지는 경우 "는 isset은"프로그램이 정말 좋은 실행되는 날을 말한다하지만 난 파일 대신의 정보를 출력해야합니다

Notice: Undefined index: id in C:\xampp\htdocs\treeview_v2\load_url_db.php on line 17 

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\treeview_v2\load_url_db.php on line 23 

Notice: Undefined variable: url in C:\xampp\htdocs\treeview_v2\load_url_db.php on line 27. 

정보를로드 할 수있는 파일은 다음입니다 :

<?php 

include_once 'acess_db.php'; 

//echo $_GET['id']; 
//// 
// 
//if(isset($_GET['id'])) 
//{ 
// read_url(); 
//} 
//else 
//{ 
// echo 'erro...'; 
//} 

$a = $_GET['id']; 
echo $a; 
read_url($a); 
function read_url($id) 
{ 
    $rs = mysql_query("select url from dados3 where id=$id"); 
    while($row = mysql_fetch_array($rs)) 
    { 
     $url = $row["url"]; 
    } 
    echo "<iframe src=\"{$url}\" style=\"height=\"75%\" width=\"100%\"></iframe>"; 
} 
?> 

는 그리고 HTML 코드는 다음과 같다 :

<?php include_once 'load_url_db.php';?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
    <meta name="keywords" content="jquery,ui,easy,easyui,web"> 
    <meta name="description" content="easyui help you build your web page easily!"> 
    <title>Async Tree - jQuery EasyUI Demo</title> 
    <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/default/easyui.css"> 
    <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/themes/icon.css"> 
    <link rel="stylesheet" type="text/css" href="http://www.jeasyui.com/easyui/demo/demo.css"> 
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.1.min.js"></script> 
    <script type="text/javascript" src="http://www.jeasyui.com/easyui/jquery.easyui.min.js"></script> 
</head> 
<body> 
    <div style="width: 300px; float: left;">  
     <ul id="tt" class="easyui-tree" url="get_tree_data_id.php" data-options="animate:true" > 
     </ul> 
    </div> 
<!-- A IFRAME CARREGA A SRC ATRAVES DO PHP--> 
<div> 
    <iframe id="a" name="ifrm1" style="float: right; width: 80%; height: 100%; visibility: hidden;" src='load_url_db.php'>  
    </iframe> 
    <button class="button" onClick="getIframeContent(a);"><span class="icon">Open</span></button> 
</div> 

<script language="Javascript" type="text/javascript"> 
//TORNA A IFRAME VISIVEL  
$('#tt').tree({ 
    onClick: function(){ 
     console.log("Entrou na funçao.."); 
     $("#a").css("visibility", "visible"); 
     var node = $('#tt').tree('getSelected');  
     console.log("Selecionou o no.."); 
     $("#a").attr('src', "load_url_db.php?id=" + node.id);  
     console.log("ID do no selecionado: " + node.id); 
    } 
}); 
</script> 

</body> 
</html> 

사람이 무엇이 잘못되었는지를 알고 난 감사합니다 나를 도울 수 있다면.

감사합니다. 데이터

if(isset($_GET['id'])) 
{ 
$a = $_GET['id']; 
} 
else 
{ 
echo "No ID Found"; 
} 
+0

[PHP의 가능한 중복 : "주의 : 정의되지 않은 변수" 및 "알림 : 정의되지 않은 인덱스"] (http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index) –

+0

$ a를 울리는 동안 적절한 값을 얻고 있습니까 ?? –

답변

0

항상 isset 구조를 사용합니다

0

당신은 가치를 전달하는 양식을 사용하여 숨겨진 필드를 사용할 필요를 할당하면서

관련 문제