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
Share on other sites

  • 2 weeks later...
  • 4 weeks later...
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.