Home > Software engineering >  How to translate ASP response.write in form for PHP use
How to translate ASP response.write in form for PHP use

Time:11-08

I don't know ASP and I am trying to convert a form over to be used in a PHP page. I have this between the form tags. Can someone tell me what the ASP part means?

<input type="hidden" name="StartingSUTypePage" value="<%response.write(varRequestPage)%>" />
<%If Request("RequestPage").Count >= 1 Then FRPMulti%>
<input type="hidden" name="RequestPage" value="<%response.write(varRequestPage)%>" />

CodePudding user response:

response.write basically maps to echo, and you might see it in both long and short form which this code shows:

asp

<% response.write(varRequestPage) %>
<%= varRequestPage %>

php

<?php echo $varRequestPage ?>
<?= $varRequestPage ?>

Request() maps to the $_REQUEST super global. The major difference between these two is that ASP searches GET, POST, cookies and server variables, in that order (ignoring client certificates), and the first one found wins. PHP on the other hand searches GET, POST and cookies (with the latter not default anymore as of PHP 7), and each time it finds one it overrides the previous call.

<%If Request("RequestPage").Count >= 1 Then FRPMulti%>
<?php if(isset($_REQUEST('RequestPage')){ /* Do something */ } ?>
  • Related