Transfer C# array to PHP to show in browser -
hy everyone, have problem can't solve. i've searched answers haven't find usefull answer. have c# code insert mysql database values, want retrieve select. array want display web browser through php because need things array. c# code use transfer array php:
while (reader.read()) { int numbers = 0; if (!reader.isdbnull(reader.getordinal("numbers"))) { numbers= reader.getint16("numbers"); } num n = new num(numbers); list.add(n); } var result = string.join(",", list); string urladdress = "http://localhost/number.php"; using (webclient client = new webclient()) { namevaluecollection postdata = new namevaluecollection() { { "result", result} }; string pagesource = encoding.utf8.getstring(client.uploadvalues(urladdress, postdata)); }
and in php use:
<?php $result = $_post["result"]; echo $result; ?>
but doesn't return in web browser. need help.
edit: php code. wanted don't use select in php, want c# code.
<?php $mysql_hostname = "localhost"; $mysql_user = "root"; $mysql_password = ""; $mysql_database = "alex"; $prefix = ""; $bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("could not connect database"); mysql_select_db($mysql_database, $bd) or die("could not select database"); ?> numbers: <form method="get" action="number.php"> <?php $query = mysql_query("select * enumerating"); while ($row = mysql_fetch_assoc($query)) { ?> <label><?php echo $row['numere']; ?></label><input type="checkbox" value="<?php echo $row['numere']; ?>" name="numar[]"><br> <?php } ?> <input type="submit" name="send" value="salveaza"> </form> <?php if(isset($_get['send'])) { ($i=0;$i<count($_get['number']);$i++) { mysql_query("insert enumerating2(numbers) values('".$_get['number'][$i]."');"); } echo "<pre>successfully!<pre>"; } ?>
Comments
Post a Comment