Jump to content

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
https://forums.phpfreaks.com/topic/304841-conversion-from-vbscript-to-pdomysql/
Share on other sites

So what is your concrete question? PHP basics like form handling and dealing with arrays are explained in the manual as well as in countless online tutorials, videos and books. If you just want somebody to do the conversion for you, there's the hire-a-programmer section.

  • Like 1

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.