Fwrite functie write niet...

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Pagina: « vorige 1 2

Matciano van Wijk

Matciano van Wijk

25/10/2011 22:04:00
Quote Anchor link
Parse error: syntax error, unexpected ';' in C:\xampp\htdocs\reserveren(1).php on line 127

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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<?
include('resfunc.php');
ini_set('display_errors', 1); // 0 = uit, 1 = aan
error_reporting(E_ALL);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Reserveringsapp</title>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
<?php
include ("db.php");
?>

</head>
<body>
<div id="wrapper">
    <div id="header">
        <div id="logo">
            <h1><a href="#">Bon Temps  </a></h1>
            <p> Waar je kunt bikken</p>
        </div>
        <div id="search">
            <form method="POST" action="zoekresultaat.php">
                <fieldset>
                <input type="text" name="s" id="search-text" size="15" />
                                <input type="submit" id="search-submit" value="Zoek" name="search"/>
                </fieldset>
            </form>
        </div>
    </div>
    <!-- end #header -->
    
    <div id="page">
    <div id="page-bgtop">
    <div id="page-bgbtm">
        <div id="content">
            <div class="post">
            
                <h2 class="title"><a href="#">Reserveren</a></h2>
                <div class="entry">
                    <form method="POST" action="reserveren2.php" name="reserveer">
                        <table border="1">
                            <tr>
                                <td>
                                    Naam:
                                </td>
                                <td>
                                    <input type="text" name="naam" size="30" required/>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Adres:
                                </td>
                                <td>
                                    <input type="text" name="adres" size="30" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Woonplaats:
                                </td>
                                <td>
                                    <input type="text" name="woonplaats" size="30" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Telefoon:
                                </td>
                                <td>
                                    <input type="text" name="telefoon" size="30" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    E-Mail:
                                </td>
                                <td>
                                    <input type="text" name="email" size="30" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Datum:
                                </td>
                                <td>
                                    <input type="text" name="datum" size="30" value="(dd-mm-jj)"/>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Begintijd:
                                </td>
                                <td>
                                    <input type="text" name="tijd" size="30" value="(00:00)"/>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Aantal personen:
                                </td>
                                <td>
                                    <input type="text" name="aantal" size="5" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    
                                </td>
                                <td>
                                    <input type="submit" name="submit" value="reserveer" align="left"/>
                                </td>
                            </tr>
                        </table>
                    </form>
                </div>
                
            </div>
        <div style="clear: both;">&nbsp;</div>
        </div>
<?php
            if(
                $res=fopen("reserveringen.txt","w");
                $info =
                        $_POST["naam"] . "\t" .
                        $_POST["adres"] . "\t" .
                        $_POST["woonplaats"] . "\t" .
                        $_POST["telefoon"] . "\t" .
                        $_POST["email"] . "\t" .
                        $_POST["datum"] . "\t" .
                        $_POST["tijd"] . "\t" .
                        $_POST["aantal"] . "\n";
    
                if(fwrite($res,$info,strlen($info)));
                    {

                        echo("Write Gelukt!")
                    }

                    else {
                        echo("Write Mislukt!")
                    }

    
                if(fclose($res))
                    {

                        echo("Close Gelukt!");
                    }

                    else {
                        echo("Close Mislukt!");
                    }
    
            ?>

                
        
        <!-- end #content -->
        <div id="sidebar">
        <br />
        <br />
        <br />
        <br />
            <table border="0" cellpadding="0" cellspacing="0"><tr><td>
                <a href="index3.php" onmouseover="setOverImg('1','');overSub=true;showSubMenu('submenu1','button1');" onmouseout="setOutImg('1','');overSub=false;setTimeout('hideSubMenu(\'submenu1\')',delay);" target=""><img src="buttons/button1up.png" border="0" id="button1" vspace="1" hspace="1"></a><br>
                <a href="reserveren.php" onmouseover="setOverImg('2','');overSub=true;showSubMenu('submenu2','button2');" onmouseout="setOutImg('2','');overSub=false;setTimeout('hideSubMenu(\'submenu2\')',delay);" target=""><img src="buttons/button2up.png" border="0" id="button2" vspace="1" hspace="1"></a><br>
                <a href="Menuoverview.php" onmouseover="setOverImg('3','');overSub=true;showSubMenu('submenu3','button3');" onmouseout="setOutImg('3','');overSub=false;setTimeout('hideSubMenu(\'submenu3\')',delay);" target=""><img src="buttons/button3up.png" border="0" id="button3" vspace="1" hspace="1"></a><br>
                </td></tr>
            </table>
        </div>
        <!-- end #sidebar -->
        <div style="clear: both;">&nbsp;</div>
    </div>
    </div>
    </div>
    <!-- end #page -->
</div>
    <div id="footer">
        <p>Copyright (c) Groep 3. All rights reserved.</p>
    </div>
    <!-- end #footer -->
</body>
</html>


Hier de volledige pagina
 
PHP hulp

PHP hulp

27/04/2024 11:46:35
 
- SanThe -

- SanThe -

25/10/2011 22:06:50
Quote Anchor link
- SanThe - op 25/10/2011 21:59:43:
Toevoeging op 25/10/2011 22:01:26:

Haal regel 2 weg en haal de puntkomma op regel 14 weg.


Dus precies wat ik al gemeld had.
 
Synaps Framework

Synaps Framework

25/10/2011 22:10:46
Quote Anchor link
Getest, en werkt.
Ik weet niet wat je met reserveren2.php moet, dus check even de comments.

Succes verder.

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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<?php
ini_set('display_errors', 1); // 0 = uit, 1 = aan
error_reporting(E_ALL);

include('resfunc.php');

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Reserveringsapp</title>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
<?php
include ("db.php");
?>

</head>
<body>
<div id="wrapper">
    <div id="header">
        <div id="logo">
            <h1><a href="#">Bon Temps  </a></h1>
            <p> Waar je kunt bikken</p>
        </div>
        <div id="search">
            <form method="POST" action="zoekresultaat.php">
                <fieldset>
                <input type="text" name="s" id="search-text" size="15" />
                                <input type="submit" id="search-submit" value="Zoek" name="search"/>
                </fieldset>
            </form>
        </div>
    </div>
    <!-- end #header -->
    
    <div id="page">
    <div id="page-bgtop">
    <div id="page-bgbtm">
        <div id="content">
            <div class="post">
            
                <h2 class="title"><a href="#">Reserveren</a></h2>
                <div class="entry">
                    <form method="POST" action="" name="reserveer">
                        <table border="1">
                            <tr>
                                <td>
                                    Naam:
                                </td>
                                <td>
                                    <input type="text" name="naam" size="30" required/>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Adres:
                                </td>
                                <td>
                                    <input type="text" name="adres" size="30" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Woonplaats:
                                </td>
                                <td>
                                    <input type="text" name="woonplaats" size="30" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Telefoon:
                                </td>
                                <td>
                                    <input type="text" name="telefoon" size="30" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    E-Mail:
                                </td>
                                <td>
                                    <input type="text" name="email" size="30" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Datum:
                                </td>
                                <td>
                                    <input type="text" name="datum" size="30" value="(dd-mm-jj)"/>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Begintijd:
                                </td>
                                <td>
                                    <input type="text" name="tijd" size="30" value="(00:00)"/>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    Aantal personen:
                                </td>
                                <td>
                                    <input type="text" name="aantal" size="5" />
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    
                                </td>
                                <td>
                                    <input type="submit" name="submit" value="reserveer" align="left"/>
                                </td>
                            </tr>
                        </table>
                    </form>
                </div>
                
            </div>
        <div style="clear: both;">&nbsp;</div>
        </div>
<?php
if($_SERVER['REQUEST_METHOD'] == 'POST') {
    $fileResource = fopen("reserveringen.txt","w");

    if( $fileResource !== false ) {

        /**
         * Er van uitgaande dat de waardes welke jij graag wilt wegschrijven bestaan.
         */


        $info = $_POST["naam"] . "\t" .
                $_POST["adres"] . "\t" .
                $_POST["woonplaats"] . "\t" .
                $_POST["telefoon"] . "\t" .
                $_POST["email"] . "\t" .
                $_POST["datum"] . "\t" .
                $_POST["tijd"] . "\t" .
                $_POST["aantal"] . "\n";
                
        $wrote = fwrite($fileResource, $info, strlen($info));
        fclose($fileResource);
        
        if( $wrote === false ) {
            echo 'Wegschrijven van data is mislukt.';
        }
else {
            //Alles is goed gegaan, redirect naar reserveren2.php?
        }
        
    
    }
}

?>

                
        
        <!-- end #content -->
        <div id="sidebar">
        <br />
        <br />
        <br />
        <br />
            <table border="0" cellpadding="0" cellspacing="0"><tr><td>
                <a href="index3.php" onmouseover="setOverImg('1','');overSub=true;showSubMenu('submenu1','button1');" onmouseout="setOutImg('1','');overSub=false;setTimeout('hideSubMenu(\'submenu1\')',delay);" target=""><img src="buttons/button1up.png" border="0" id="button1" vspace="1" hspace="1"></a><br>
                <a href="reserveren.php" onmouseover="setOverImg('2','');overSub=true;showSubMenu('submenu2','button2');" onmouseout="setOutImg('2','');overSub=false;setTimeout('hideSubMenu(\'submenu2\')',delay);" target=""><img src="buttons/button2up.png" border="0" id="button2" vspace="1" hspace="1"></a><br>
                <a href="Menuoverview.php" onmouseover="setOverImg('3','');overSub=true;showSubMenu('submenu3','button3');" onmouseout="setOutImg('3','');overSub=false;setTimeout('hideSubMenu(\'submenu3\')',delay);" target=""><img src="buttons/button3up.png" border="0" id="button3" vspace="1" hspace="1"></a><br>
                </td></tr>
            </table>
        </div>
        <!-- end #sidebar -->
        <div style="clear: both;">&nbsp;</div>
    </div>
    </div>
    </div>
    <!-- end #page -->
</div>
    <div id="footer">
        <p>Copyright (c) Groep 3. All rights reserved.</p>
    </div>
    <!-- end #footer -->
</body>
</html>
Gewijzigd op 25/10/2011 22:11:36 door Synaps Framework
 
Matciano van Wijk

Matciano van Wijk

25/10/2011 22:16:51
Quote Anchor link
Zelf ook getest, en zie dat het werkt. Thanks!
 

Pagina: « vorige 1 2



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.