Jump to content

PHP code needed - PHP Form values


Recommended Posts

I am using MS Access, winxp, ASP. The following code works fine in ASP when I select only one country. If check two or more countries, it does not work. Can you please modify the following code to work in PHP if I select 1 or 2 or 3 or more countries. Thank you in advance.

 

PLEASE NEED PHP CODE.

 

----------

<html>
<head>
<title>Untitled</title>
</head>

<body>

<% if request.form("country") = "" then %>

<form action='aspformdata.asp' method="post">
<input type="checkbox" name="COUNTRY" value="USA">USA<br>
<input type="checkbox" name="COUNTRY" value="Canada">Canada<br>
<input type="checkbox" name="COUNTRY" value="Denmark">Denmark<br>
<input type="checkbox" name="COUNTRY" value="China">China<br>
<input type="checkbox" name="COUNTRY" value="Japan">Japan<br>
<input type='submit' name='submit' value='Submit'>
</form>

<% Else  %>

<%
set cn = server.createObject("ADODB.Connection")
cn.open "dsn=northwind"

courntry = request.form("country")
%>

<%
sql = "select * from customers where country = '" & request.form("country") & "' order by country"
set rs = server.createObject("ADODB.RecordSet")
rs.open sql, cn
%>

<table>
<tr>
<td> CompanyName</font></td><td> City</font></td><td> State</font></td>
</tr>


<%
Do Until rs.EOF
%>					
<tr>
<td> <%= rs("CompanyName")%></font> </td>
<td> <%= rs("City")%></font></td>
<td> <%= rs("State")%></font> </td>
</tr>

<%
rs.movenext
loop
%>

<% End if%>
</table>
</body>
</html>



Link to comment
https://forums.phpfreaks.com/topic/236745-php-code-needed-php-form-values/
Share on other sites

  • 2 weeks later...
  • 4 weeks later...

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.