
January 16th, 2007, 08:43 AM
|
|
Contributing User
|
|
Join Date: Aug 2005
Location: North East, UK
|
|
|
Print_r() function ASP/VBScript
Here is an example of a print_r equivalent to the PHP print_r() function in ASP VBScript.
It is not an exact match but it should work.
As with PHP if you want to specify an array element you need to add [] to the element name
Code:
<form name="form1" method="post" action="">
<p>
<input name="textfield" type="text" value="Joe, Bob">
</p>
<p>
<input name="checkbox[]" type="checkbox" value="Joe" checked>
<input name="checkbox[]" type="checkbox" value="Bob" checked>
</p>
<p>
<select name="select[]" size="2" multiple>
<option value="Joe" selected>Joe</option>
<option value="Bob" selected>Bob</option>
</select>
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
php Code:
Original
- php Code |
|
|
|
asp Code:
Original
- asp Code |
|
|
|
Sub print_r(a) Response.Write "Array (" For Each i In a i = Trim(i) If Right(i,2) = "[]" Then Response.Write " [" & Left(i,Len(i)-2) & "] => Array ( " s = Split(a(i),",") For c=0 To Ubound(s) Response.Write " [" & c & "]" & " => " & s(c) Next Response.Write " )" Else Response.Write " [" & i & "] => " & a(i) End If Next Response.Write " )" End Sub Call print_r(Request.Form)
|