can someone pls convert this jsp page to php.. <jsp:include page=\"./header.jsp\
ID: 3804964 • Letter: C
Question
can someone pls convert this jsp page to php..
<jsp:include page="./header.jsp"></jsp:include>
<link href="italics.css" rel="stylesheet" type="text/css" />
<%
if(request.getAttribute("error") != null) {
%>
<p><strong><font color="red"><%=request.getAttribute("error") %></font></strong>
Click <a href="register.jsp"><strong>here</strong></a> to register.</p>
<%
}
%>
<center>
<form action="./loginconf.jsp" method="post">
<table>
<tr>
<td align="center" colspan="2" class="italics"><b>User Login</b></td>
</tr>
<tr>
<td>Username:</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="password"></td>
</tr>
<tr>
<td align="center"><input type="submit" value="Log In"></td>
<td align="center"><input type="reset" value="Clear"></td>
</tr>
</table>
</form>
</center>
</body>
</html>
***************************
i have my own header.jsp file, but i dont know how do i include header.php in the above file?
Explanation / Answer
<?php
include './header.php'; //to include pages in php we use 'include' function
?>
<link href="italics.css" rel="stylesheet" type="text/css" />
<?php
if(is_null($_REQUEST['error'])) { //we get the request variables in php through '$_REQUEST' array
echo '<p><strong><font color="red"><%=request.getAttribute("error") %></font></strong> Click <a href="register.jsp"><strong>here</strong></a> to register.</p>';
}
?>
<center>
<form action="./loginconf.jsp" method="post">
<table>
<tr>
<td align="center" colspan="2" class="italics"><b>User Login</b></td>
</tr>
<tr>
<td>Username:</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="password"></td>
</tr>
<tr>
<td align="center"><input type="submit" value="Log In"></td>
<td align="center"><input type="reset" value="Clear"></td>
</tr>
</table>
</form>
</center>
</body>
</html>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.