Jump to content

Conversion from VBScript to PDO/MYSQL


FreddoB

Recommended Posts

Hello. I have a very old order form that I developed with VBS/Access many years ago and I'm now converting it to PDO/MYSQL and I am stuck with conversion regarding arrays. I am almost totally new to PHP and have gone well so far with the project. Any help would be much appreciated. The following is the form and the VBS for posting to a review order page:

There are 4 categories and the following form code for each category is within the one <form></form>:

<input type="hidden" name="plantname1[ ]" value = "<?php echo $row['plantname']; ?>" />
             140mm @ $<?php echo $row['price140']; ?>
             UNITS REQUIRED<input type="text" name="quantity1[ ]" size="5" maxlength="10" value="0" />        

I have set the [], which I understand is necessary for the various arrays. The Plantname and Quantity is posted through to the Preview Order page.

On the Preview Order page there is the following code for each category:

<% Dim arrPlants, arrAmounts, x
arrPlants=Split(strPlantname1, ", ")
arrAmounts=Split(strQuantity1, ", ")

For x=0 To UBound(arrPlants)
   If CLngN(arrAmounts(x))>0 Then
      response.write (arrAmounts(x)&" "&arrPlants(x)&"<br>")     
   End If
Next

Function CLngN(n)
   CLngN=0 'default value!
   On Error Resume Next
      CLngN=CLng(n)
      Err.Clear
   On Error Goto 0
End Function
%>

At the end of the 4 lots of code for the 4 categories is the following for each category, 1 to 4:

<%
Dim strToSend1
For x=0 To UBound(arrPlants)
   If CLngN(arrAmounts(x))>0 Then
      strToSend1=strToSend1&arrAmounts(x)&" "&arrPlants(x)& " "
   End If
Next
%>

 

Link to comment
Share on other sites

Thanks for the reply. I will look at the tutorials and see if I can code it myself. I have attempted it but I hit a brick wall and thought it might be easier to get some help with converting the VBS.

 

I will post separate questions regarding what I have already coded.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.