# JQuery to PHP - thats all

**URL:** https://forum.kirupa.com/t/jquery-to-php-thats-all/325242
**Category:** programming
**Created:** [October 4, 2011, 12:38pm UTC](https://forum.kirupa.com/t/jquery-to-php-thats-all/325242 "2011-10-04T12:38:20Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![jeancnicolas](https://avatars.discourse-cdn.com/v4/letter/j/7bcc69/32.png) [@jeancnicolas](https://forum.kirupa.com/u/jeancnicolas)
#### Post date: [October 4, 2011, 12:38pm UTC](https://forum.kirupa.com/t/jquery-to-php-thats-all/325242/1 "2011-10-04T12:38:20Z")

</div>

Hi there,

I have been trying for hours to just pass a variable from my HTML to a JQuery post which connects to my PHP file, reading the variable sent in the POST, and updating my database.

Basically - my PHP is not getting the variable im sending to it - though it is definitely going as my HTML says so.

my HTML click function says:

```auto
$.post("setDB.php",{id:$('#myTxt').val()});

```

my PHP - connects to its DB with its new MySQLi set to $mysqli - says:

```auto
$id = $_POST['id'];
$query = "INSERT videos SET src = $id";
$result = $mysqli->query($query) or die($mysqli_error($mysqli));

```

Any hints for how to get my PHP to read $id… /… /./.??
