Toon posts:

Uitlijning formulier in HTML

Pagina: 1
Acties:
  • 190 views

Acties:
  • 0 Henk 'm!

Verwijderd

Topicstarter
Ik heb een contactformulier in HTML gecombineerd met PHP.

Als je de site bekijkt zie je dat de uitlijning lelijk is EN het hele boeltje is te breed.
http://www.pds-galaxis.nl/contact.php

De pagina codering is alsvolgt:

PHP:
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
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Party Disco Show GALAXIS | Contact |</title>
<link href="opmaak.css" rel="stylesheet" type="text/css" />
</head>

<body>


<div id="container">

<div id="header1">
  <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="698" height="227">
    <param name="movie" value="images/menu pds.swf" />
    <param name="quality" value="high" />
    <embed src="images/menu pds.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="698" height="227"></embed>
  </object>
</div>
<div id="content">
  <table width="550" align="center">
    <tr bgcolor="#191919">
      <td><div id="div"><p>
        <?php
session_start();
ini_set('display_errors', 1);
error_reporting(E_ALL);

ob_start();
// Config Gedeelte
$cfg['url'] = "http://www.pds-galaxis.nl";// Site waarnaar je terug gaat als je een bericht hebt achtergelaten
$cfg['naam'] = "Bob Laarmans";                // Webmaster naam
$cfg['email'] = "bob@pds-galaxis.nl";        // Webmaster E-mail
$cfg['spam'] = 60;                        // Anti Spam Tijd in Minuten ( Voer "0" om de Spam Beveiliging uit te zetten )
$cfg['text'] = TRUE;                    // Bij Fout Text Rood maken ( TRUE voor aan, FALSE voor uit )
$cfg['input'] = TRUE;                    // Bij Fout Border om Vakje Rood maken ( TRUE voor aan, FALSE voor uit )
$cfg['HTML'] = TRUE;                    // Een HTML email ( TRUE voor aan, FALSE voor uit )
$cfg['CAPTCHA'] = TRUE;                    // CAPTCHA ( TRUE voor aan, FALSE voor uit )


// Hieronder niks meer veranderen
// E-mail Checker / Validator
function checkmail($email)
{
    if(eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\\.[a-z]{2,4}$", $email))
    {
        return TRUE;
    }
    return FALSE;
}

$formulier = TRUE;

if(!isset($_COOKIE['formulier']))
{
    if(isset($_POST['wis']) && ($_SERVER['REQUEST_METHOD'] == "POST"))
    {
        foreach($_POST as $key => $value)
        {
            unset($value);
        }
        header("Location: ".$_SERVER['PHP_SELF']."");
    }

    if(isset($_POST['verzenden']) && ($_SERVER['REQUEST_METHOD'] == "POST"))
    {
        $aFout = array();

        $naam = trim($_POST['naam']);
        $email = trim($_POST['email']);
        $onderwerp = trim($_POST['onderwerp']);
        $bericht = trim($_POST['bericht']);

        if($cfg['CAPTCHA'])
        {
            $code = $_POST['code'];
        }

        if(empty($naam) || (strlen($naam) < 3) || eregi("[<>]", $naam) )
        {
            $aFout[] = "Er is geen naam ingevuld.";
            unset($naam);
            $fout['text']['naam'] = TRUE;
            $fout['input']['naam'] = TRUE;
        }
        if(empty($email))
        {
            $aFout[] = "Er is geen e-mail adres ingevuld.";
            unset($email);
            $fout['text']['email'] = TRUE;
            $fout['input']['email'] = TRUE;
        }
        elseif(checkmail($email) == 0)
        // Wanneer je PHP 5.2 > gebruikt
        //elseif(!filter_var($email, FILTER_VALIDATE_EMAIL))
        {
            $aFout[] = "Er is geen correct e-mail adres ingevuld.";
            unset($email);
            $fout['text']['email'] = TRUE;
            $fout['input']['email'] = TRUE;
        }
        if(empty($onderwerp))
        {
            $aFout[] = "Er is geen onderwerp ingevuld.";
            unset($onderwerp);
            $fout['text']['onderwerp'] = TRUE;
            $fout['input']['onderwerp'] = TRUE;
        }
        if(empty($bericht))
        {
            $aFout[] = "Er is geen bericht ingevuld.";
            unset($bericht);
            $fout['text']['bericht'] = TRUE;
            $fout['input']['bericht'] = TRUE;
        }
        if($cfg['CAPTCHA'])
        {
            if(strtoupper($code) != $_SESSION['captcha_code'])
            {
                $aFout[] = "Er is geen correcte code ingevuld.";
                $fout['text']['code'] = TRUE;
                $fout['input']['code'] = TRUE;
            }
        }
        if(!$cfg['text'])
        {
            unset($fout['text']);
        }
        if(!$cfg['input'])
        {
            unset($fout['input']);
        }
        if(!empty( $aFout ))
        {
            $errors = '
            <div id="errors">
            <ul>';
            foreach($aFout as $sFout)
            {
                $errors .= "    <li>".$sFout."</li>\n";
            }
            $errors .= "</ul>
            </div>";
        }
        else
        {
            $formulier = FALSE;


            if($cfg['HTML'])
            {
                // Headers
                $headers = "From: \"Contact Formulier\" <".$cfg['email'].">\r\n";
                $headers .= "Reply-To: \"".$naam."\" <".$email.">\n";
                $headers .= "Return-Path: Mail-Error <".$cfg['email'].">\n";
                $headers .= "MIME-Version: 1.0\n";
                $headers .= "Content-Transfer-Encoding: 8bit\n";
                $headers .= "Content-type: text/html; charset=iso-8859-1\n";


                $bericht = '
                <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
                <html>
                <head>
                </head>

                <body>
                <br />
                <b>Naam:</b> '.$naam.'<br />
                <b>Email:</b> <a href=\"mailto:'.$email.'\">'.$email.'</a><br />
                <br />
                <b>Bericht:</b><br />
                '.$bericht.'
                <br />
                <br />
                <br />
                --------------------------------------------------------------------------<br />
                <b>Datum:</b> '.date("d-m-Y @ H:i:s").'<br />
                <b>IP:</b> <a href=\"http://sunny.nic.com/cgi-bin/whois?domain='.$_SERVER['REMOTE_ADDR'].'\">'.$_SERVER['REMOTE_ADDR'].'</a><br />
                <b>Host:</b> '.gethostbyaddr($_SERVER['REMOTE_ADDR']).'<br />
                </body>
                </html>';
            }
            else
            {
                $bericht_wrap = wordwrap ($bericht, 40, "\n", 1);
                // Headers
                $headers = "From: \"Contact Formulier\" <".$cfg['email'].">\n";
                $headers .= "MIME-Version: 1.0\n";
                $headers .= "Content-type: text/plain; charset='iso-8859-1'\n";

                // Bericht
                $message = "Naam: ".$naam."        \n";
                $message .= "E-mail: ".$email."     \n";
                $message .= "Bericht:\n".$bericht_wrap."     \n ";
                $message .= "               \n ";
                $message .= "Datum: ".date("d-m-Y H:i:s")." \n";
                $message .= "------------------------------------------------------- \n ";
                $message .= "IP: ".$_SERVER['REMOTE_ADDR']."                    \n ";
                $message .= "Host: ".gethostbyaddr($_SERVER['REMOTE_ADDR'])."                \n ";

            }

            if(mail($cfg['email'], "[Contact] ".$onderwerp, $bericht, $headers))
            {
                if(isset($_POST['stuurkopie']))
                {
                    $headers = "From: \"Contact Formulier\" <".$email.">\r\n";
                    $headers .= "Reply-To: \"".$naam."\" <".$email.">\n";
                    $headers .= "Return-Path: Mail-Error <".$email.">\n";
                    $headers .= "MIME-Version: 1.0\n";
                    $headers .= "Content-Transfer-Encoding: 8bit\n";
                    $headers .= "Content-type: text/html; charset=iso-8859-1\n";

                    mail($email, "[Contact] ".$onderwerp, $bericht, $headers);

                }

                unset($naam, $email, $onderwerp, $bericht);
                setcookie("formulier", 1, time() + ( $cfg['spam'] * 60 ) );

                echo "
                <p>
                Uw bericht is succesvol verzonden, er word zo snel mogelijk gereageerd.<br />
                <br />
                Met vriendelijke groeten,<br />
                <b>".$cfg['naam']."</b>
                </p>
                ";
            }
            else
            {
                echo "Er is een fout opgetreden bij het verzenden van de email";
            }
            header("refresh:3;url=".$cfg['url']."");
        }
    }
    if($formulier)
    {
    ?>
    <!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>
        <link href="style.css" rel="stylesheet" type="text/css" />

        <title>Contact Formulier door Thijs</title>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <meta http-equiv="Content-Language" content="nl" />
    </head>

    <body>
    <div id="container">
    <?php
    if(isset($errors)) {
        echo $errors;
    }
    ?>

    <h3>Contact Formulier</h3>
        <form method="post" action="<?php $_SERVER['PHP_SELF']; ?>">
        <p>
        <label <?php if(isset($fout['text']['naam'])) { echo 'class="fout"'; } ?>>Naam:</label>
        <input type="text" id="naam" name="naam" maxlength="30" <?php if(isset($fout['input']['naam'])) { echo 'class="fout"'; } ?> value="<?php if (!empty($naam)) { echo stripslashes($naam); } ?>" /><br />

        <label <?php if(isset($fout['text']['email'])) { echo 'class="fout"'; } ?>>Email:</label>
        <input type="text" id="email" name="email" maxlength="255" <?php if(isset($fout['input']['email'])) { echo 'class="fout"'; } ?> value="<?php if (!empty($email)) { echo stripslashes($email); } ?>" /><br />

        <label <?php if(isset($fout['text']['onderwerp'])) { echo 'class="fout"'; } ?>>Onderwerp:</label>
        <input type="text" id="onderwerp" name="onderwerp" maxlength="40" <?php if(isset($fout['input']['onderwerp'])) { echo 'class="fout'; } ?> value="<?php if (!empty($onderwerp)) { echo stripslashes($onderwerp); } ?>" /><br />

        <label <?php if(isset($fout['text']['bericht'])) { echo 'class="fout"'; } ?>>Bericht:</label>
        <textarea id="bericht" name="bericht" <?php if(isset($fout['input']['bericht'])) { echo 'class="fout"'; } ?> cols="35" rows="6"><?php if (!empty($bericht)) { echo stripslashes($bericht); } ?></textarea><br />

        <?php
        if($cfg['CAPTCHA'])
        {
        ?>
        <label></label>
        <img src="captcha.php" alt="" /><br />

        <label <?php if(isset($fout['text']['code'])) { echo 'class="fout"'; } ?>>Code:</label>
        <input type="text" id="code" name="code" maxlength="4" size="4" <?php if(isset($fout['input']['code'])) { echo 'class="captcha fout"'; } ?> /><br />
        <?php
        }
        ?>
        <label for="stuurkopie">Stuur mij een kopie</label><input type="checkbox" id="stuurkopie" name="stuurkopie" value="1" /><br />

        <label></label>
        <input type="submit" id="verzenden" name="verzenden" value="verzenden" />
        </p>
        </form>
    </div>

</body>
</html>
    <?php
    }
}
else
{
    echo "
    <p>
    U kunt maar eens in de ".$cfg['spam']." minuten een e-mail versturen!<br />
    U wordt nu automatisch doorgestuurd.
    </p>";
    header("refresh:3;url=".$cfg['url']."");
}
?>

      </div></td>
    </tr>
  </table>
  <p><center><script type="text/javascript"><!--
google_ad_client = "pub-2335145032074541";
/* 468x60, gemaakt 26-2-09 */
google_ad_slot = "6628201296";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center>
</div>

        <div id="afteller">
        <table style="width: 540px; text-align: left; margin-left: auto; margin-right: auto;">
            <tbody>
            <tr>
            <td valign="bottom">
    <br>
            </td>
            </tr>
            </tbody>
    </table>
        </div>

<div class="style1" id="footer"><br/>
© Party Disco Show GALAXIS 2009. Alle rechten voorbehouden.
  </div>

</div>


</body>
</html>

Acties:
  • 0 Henk 'm!

  • Wiethoofd
  • Registratie: Juli 2007
  • Laatst online: 14-08 12:22

Wiethoofd

Broadcast TOM

Cascading Stylesheet:
1
2
3
4
5
6
#container {
margin-left:auto;
margin-right:auto;
margin-top:10px;
width:700px;
}

zoals je ziet staat je width in je opmaak.css op 700, maak die eens 600 en hij past precies

Volg me op Twitter/X & Bluesky


Acties:
  • 0 Henk 'm!

  • RobIII
  • Registratie: December 2001
  • Niet online

RobIII

Admin Devschuur®

^ Romeinse Ⅲ ja!

(overleden)
RobIII in "PHP formuliertje"

Komaan zeg; we zijn geen afhaalchinees waar je even in een halve zin je probleem uitlegt en vervolgens een lap code dumpt en wij lossen het voor u op terwijl u wacht :X

[ Voor 60% gewijzigd door RobIII op 04-03-2009 21:20 ]

There are only two hard problems in distributed systems: 2. Exactly-once delivery 1. Guaranteed order of messages 2. Exactly-once delivery.

Je eigen tweaker.me redirect

Over mij


Dit topic is gesloten.