[Jquery , ajax, php, mysql] Loadpage

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Senior, Medior and Junior SAP HANA Developer

Vacature details Vakgebied: Software/IT Opleiding: Medior Werklocatie: Veldhoven Vacature ID: 12696 Introductie Our client is the world's leading provider of lithography systems for the semiconductor industry, manufacturing complex machines that are critical to the production of integrated circuits or chips. Our purpose is “unlocking the potential of people and society by pushing technology to new limits”. We do this guided by the principles “Challenge”, “Collaborate” and “Care”. Wat verwachten we van jou? SAP Certified Application Associate - SAP HANA Cloud Modeling (training and/or certification) Bachelor degree or higher Excellent understanding of SAP HANA (2.0 / Cloud), Data Modelling and writing

Bekijk vacature »

Rick kem

rick kem

09/04/2014 19:14:34
Quote Anchor link
Hallo,

Ik heb het volgende script

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<script type="text/javascript">

var loadedobjects=""
var rootdomain="http://"+window.location.hostname

function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
page_request.open('GET', url, true)
page_request.send(null)
}

function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}

function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}

</script>


Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<div id="leftcolumn">
        <?php
        $sql_stores
= mysql_query("SELECT * FROM stores WHERE buy = '".mysql_real_escape_string($_SESSION['buy'])."' AND status = '0' ORDER BY id ASC LIMIT 20");
        if(mysql_num_rows($sql_stores) == 0){
            echo'<div class="error">Er zijn geen panden beschikbaar';
        }
else{
            while($row_stores = mysql_fetch_object($sql_stores)){
            ?>

                <a href="javascript:ajaxpage('pages/start/locations.php?id=<?php echo htmlentities($row_stores->id,ENT_QUOTES); ?>', 'rightcolumn');"><?php echo ucfirst(htmlentities($row_stores->name,ENT_QUOTES)); ?></a>
        <?php
            }
        }

        ?>

        </div>
        
        <div id="rightcolumn"><?php include("pages/start/locations.php"); ?></div>


Alles werkt op dit moment, alleen nu wil ik op de pagina 'locations' een submit button plaatsen zodat men door kan gaan.

Echter werkt dit niet.

De code hiervan is:
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
if(isset($_GET['id'])){
    include("../../include/config.php");
    $sql = mysql_query("SELECT * FROM stores WHERE buy = '".mysql_real_escape_string($_SESSION['buy'])."' AND status = '0' AND id = '".mysql_real_escape_string($_GET['id'])."' ORDER BY id DESC LIMIT 1");
    if(empty($_GET['id']) || !ctype_digit($_GET['id']) || mysql_num_rows($sql) == 0){
        echo'<div class="error">Deze locatie ontbreekt.</div>';
    }
else{
        $row = mysql_fetch_object($sql);
        $i = htmlentities($row->id,ENT_QUOTES);
        echo htmlentities($row->message,ENT_QUOTES);
        if(isset($_POST['location'.$i])){
            echo'x';
        }

?>

    <form method="POST" action="#">
    <tr>
                <td width="50%">
                <input type="submit" value="Bevestig locatie" name ="location<?php echo htmlentities($row->id,ENT_QUOTES); ?>" />
                </td>
            </tr>
        </table>
<?php
    }
}
else{
    echo'Maak een keuze uit een van de panden die links in het rijtje staan aangegeven.';
}

?>


Ik heb geen idee hoe ik dit moet gaan doen.

Alvast bedankt
 
Er zijn nog geen reacties op dit bericht.



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.