html - form php not working [array] -
i need show var_dump
'selected country' , can't , because problem in $res (array) $id
<?php if(isset ($_post['submit'])) { $id = $_post['cata']; $api = new soapclient ( 'http://www.webservicex.com/globalweather.asmx?wsdl' ); $res = $api->getcitiesbycountry(array( 'countryname' =>"$id")); var_dump($res); } ?> <form action="" name="cata"> <select> <option>israel</option> <option>egypt</option> </select> <br> <input id='sumbit' name='submit' type='submit' value='tim'> </form>
still not working , think problem in
$res = $api->getcitiesbycountry(array( 'countryname' =>"$id"));
define cata
select
name not form
name
so define form below
<form action="" method="post"> //<--- set method retrieving data in php <select name="cata"> //<--here name field <option>israel</option> <option>egypt</option> </select> <br> <input id='sumbit' name='submit' type='submit' value='tim'> </form>
and set in php
$id = $_post['cata']
Comments
Post a Comment