vraag over script

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Ivo

ivo

13/02/2007 13:11:00
Quote Anchor link
Hallo ik hebt een soort van webwinkel gemaakt nu wil ik de producten afhandelen met een bestel formulier maar ik weet niet echt hoe dat moet
de opdracht moet vandaag klaar zijn

hier de code waar het om gaat

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
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
 "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head><style type="text/css">
#container {
width: 800px;
border: 0px solid black;
margin: 0px;
margin-left: auto;
margin-right: auto;
padding: 10px;
}
#header {
padding: 10px;
margin-bottom: 0px;
background-image:  url(images/header.jpg);
}
#main {
padding: 10px;
margin-bottom: 0px;
background-image:  url(images/menu.jpg);
}
#inhoud {
padding: 10px;
background-color: white;
}
#footer {
padding: 10px;
background-image:  url(images/menu.jpg);
}
</style>
<title>i2web.nl</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<META NAME="keywords" CONTENT="webdesign,design,scripting,">
<link href="i2web.css" rel="stylesheet" type="text/css">
</head>
<script>

function open_window(url) {
    window.open(url,"MyWin",'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=yes,resizable=yes,width=450,height=250');
}

function ShowPic(url,title,x1,y1) {

    window.open('image.php?i='+url+'&t='+title+'', 'MyWin', 'top=1,width=' + x1 + ', height=' + y1 + '');

}

</script>
<body>
<div id="container">
  <div id="header" class="header">
    <?php
    include"inc/config.inc.php";
    $select = mysql_query("SELECT * FROM algemeen") or die(mysql_error());
            while($obj = mysql_fetch_object($select)){
            echo "$obj->headertitel<br></a>";
            ?>

    
  </div>
  <div id="main" class="foo">Main menu  <? include"inc/menu.inc.php"; ?></div>
  <div id="inhoud" class="foo">
    <table width="75%" border="0">
      <tr>
        <td valign="top"> <br>
          <table width="100%" border="0">
            <tr>
              <td width="18%"><table width="128" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="138"><img src="images/browse.gif" width="128" height="23"></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td><div align="center">
                <table width="112" border="0" align="center" cellpadding="4" cellspacing="0">
                  <tr>
                    <td>
                      <? require_once("categories.php"); ?>
                    </td>
                  </tr>
                </table>
              </div></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
          </tr>
          <tr>
            <td><img src="images/newsleter.gif" width="124" height="17"></td>
          </tr>
          <tr>
            <td><form method="post" action="mail.php" name=sb >
                <br>
                <table width="99" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="92"><input type=text name=nEmail size=10 value="email address">
                    </td>
                    <td width="213"><input type=submit name=smail value=Go!></td>
                  </tr>
                </table>
              </form></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
          </tr>
        </table>
              </td>
              <td valign="top" width="82%"><?
require_once("inc/config.inc.php");

if(!empty($_GET[Start]))
{

    $Start = $_GET[Start];
}

else
{
    $Start = '0';
}


$ByPage = "5";


if(empty($_GET[SubcategoryID]))
{
    

    $q1 = "select devbg_products.*, devbg_categories.*, devbg_subcategories.* from devbg_products
                            left join devbg_categories on devbg_products.ItemCategory = devbg_categories.CategoryID
                            left join devbg_subcategories on devbg_products.ItemSubcategory = devbg_subcategories.SubcategoryID

                            where devbg_products.ItemCategory = '$_GET[CategoryID]'

                            order by ItemName limit $Start, $ByPage"
;

    $qnav = "select devbg_products.*, devbg_categories.*, devbg_subcategories.* from devbg_products
                            left join devbg_categories on devbg_products.ItemCategory = devbg_categories.CategoryID
                            left join devbg_subcategories on devbg_products.ItemSubcategory = devbg_subcategories.SubcategoryID

                            where devbg_products.ItemCategory = '$_GET[CategoryID]' "
;
}

else
{

    $q1 = "select devbg_products.*, devbg_categories.*, devbg_subcategories.* from devbg_products
                            left join devbg_categories on devbg_products.ItemCategory = devbg_categories.CategoryID
                            left join devbg_subcategories on devbg_products.ItemSubcategory = devbg_subcategories.SubcategoryID

                            where devbg_products.ItemCategory = '$_GET[CategoryID]' and
                                      devbg_products.ItemSubcategory = '$_GET[SubcategoryID]'

                            order by ItemName limit $Start, $ByPage"
;

    $qnav = "select devbg_products.*, devbg_categories.*, devbg_subcategories.* from devbg_products
                            left join devbg_categories on devbg_products.ItemCategory = devbg_categories.CategoryID
                            left join devbg_subcategories on devbg_products.ItemSubcategory = devbg_subcategories.SubcategoryID

                            where devbg_products.ItemCategory = '$_GET[CategoryID]' and
                                  devbg_products.ItemSubcategory = '$_GET[SubcategoryID]' "
;
}




$r1 = mysql_query($q1) or die(mysql_error());

if(mysql_num_rows($r1) == '0')
{

    $NoItems = "<center>There are no items at this category!</center>";
}

else
{


while($a1 = mysql_fetch_array($r1))
{

    $MyPrice = number_format($a1[ItemPrice], 2, ".", "");

    if(!empty($a1[ItemImage]))
    {

        $xy = getimagesize("items_images/$a1[ItemImage]");
        $x = $xy[0];
        $y = $xy[1];

        $NewItemName = str_replace("'", "", $a1[ItemName]);

        $DisplayImage = "<a href=\"javascript:ShowPic('items_images/$a1[ItemImage]', '$NewItemName', '$x', '$y');\"><img src=\"items_images/$a1[ItemImage]\" width=100 alt=\"$a1[ItemName]\" border=0 style=\"border-color:black\"></a>";
    }

    else
    {
        $DisplayImage = "&nbsp;";
    }


    $DisplayCategory .= "
    <table align=center width=300 border=0 rules=rows cellspacing=0 bordercolor=black>
    <tr>
        <td valign=top width=140>$DisplayImage</td>

        <td width=160 valign=top>
                <a class=\"ItemTitle\" href=\"ViewItem.php?ItemID=$a1[ItemID]\">$a1[ItemName]</a><BR>
                    <br>
                <font color=black face=verdana size=1><b>Category: </b></font><a class=\"CategoryClass\" href=\"ShowCategory.php?CategoryID=$a1[ItemCategory]\">$a1[CategoryName]</a>"
;

        if(!empty($a1[SubcategoryID]))
        {

            $DisplayCategory .= ", <a class=\"SubcategoryClass\" href=\"ShowCategory.php?CategoryID=$a1[ItemCategory]&SubcategoryID=$a1[ItemSubcategory]\">$a1[SubcategoryName]</a>";
        }


        $DisplayCategory .= "
                    <br>
                <font color=red face=verdana size=2><b>Price: $$MyPrice</b></font>


                <br><br>

                <form method=post action=bestel.php style=\"margin:0\">
                    <input type=hidden name=ItemID value=\"$a1[ItemID]\">
                    <input type=hidden name=ItemName value=\"$a1[ItemName]\">
                    <input type=hidden name=ItemShipping value=\"$a1[ItemShipping]\">
                    <input type=hidden name=ItemPrice value=\"$MyPrice\">
                    <input type=submit name=s1 value=\"Bestel\" class=sub>

                </form>


            </td>                    
    </tr>

    </table><br><hr size=1 color=E3E3E3>"
;


}



//build the "next" - "prev" navigatioin

$rnav = mysql_query($qnav) or die(mysql_error());
$rows = mysql_num_rows($rnav);

    if($rows > $ByPage)
    {

            $NextPrev =  "<br><table align=center width=600>";
            $NextPrev .= "<td align=center><font face=verdana size=2> | ";

            $pages = ceil($rows/$ByPage);

            for($i = 0; $i <= ($pages); $i++)
            {

                $PageStart = $ByPage*$i;

                $i2 = $i + 1;

                if($PageStart == $Start)
                {

                    $links[] = " <span class=DNav>$i2</span>\n\t ";
                }

                elseif($PageStart < $rows)
                {

                    $links[] = " <a class=Nav href=ShowCategory.php?Start=$PageStart&ByPage=$ByPage&CategoryID=$_GET[CategoryID]&SubcategoryID=$_GET[SubcategoryID]>$i2</a>\n\t ";    
                }
            }


            $links2 = implode(" | ", $links);
        
            $NextPrev .= $links2;

            $NextPrev .=  "| </td>";

            $NextPrev .= "</table><br>\n";
    }

}


if(isset($NoItems))
{

    echo $NoItems;
}

else
{
    require_once("templates/ShowCategoryTemplate.php");
}


?>
              </td>
            </tr>
          </table>
          <br>
          <br>
          <br>
        </td>
      </tr>
    </table>
  </div>
  <div id="footer" class="foo">
    <?php include_once"copyright.php"; ?>
    <a href="http://www.webmasterstart.nl/link_in.php?id=3161"> Webmasterstart.nl
    -D start voor webmasters!</a> </div>
</div>
</body>
</html>
<? } ?>
Gewijzigd op 01/01/1970 01:00:00 door Ivo
 
PHP hulp

PHP hulp

02/05/2024 21:41:35
 
Ivo

ivo

13/02/2007 13:11:00
Quote Anchor link
Ook online te bekijken op
http://www.i2web.nl/showroom.php
 
Ivo

ivo

13/02/2007 16:12:00
Quote Anchor link
om het beter te zeggen hij moet de waarde mee geven
 
Arjan Kapteijn

Arjan Kapteijn

13/02/2007 16:24:00
Quote Anchor link
Okay, jij hebt een opdracht aangenomen om voor iemand vandaag iets te maken, een opdracht met een deadline en bij jou ontbreekt helaas de kennis om dat zelf te maken. Vervolgens moeten wij 298 regels script door gaan lezen?

Kom even met een wat precizere opdrachtbeschrijven want hier kan ik vrij weinig mee. Wat werkt er niet? Wat heb je geprobeerd? Wat is relevante code?
 



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.