0

For an ajax query together with bootstrap validation, I'm taking the form input as below

var formData = {
                'membername'        : $('input[name=membername]').val(),
                'createddate'       : $('input[name=createddate]').val(),
                'membergroupno'    : $('input[name=membergroupno]').val(),
                'send'              : $('button[name=send]').val()
            };

My problem is the input ID & Name are all dynamic (for eg:, name1, name2,...etc). How can I assign dynamic name to the above or, in a better way rewrite the above piece of code to accommodate the dynamic names/id.

The piece of code is a part of the ajax form submit process. Appreciate if anyone could help.

keyem
  • 51
  • 7
  • Possible duplicate of [Why shouldn't I use mysql\_\* functions in PHP?](https://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php) – Dharman Jul 04 '19 at 17:26
  • **Warning:** `mysql_*` extension is deprecated as of PHP 5.5.0, and has been removed as of PHP 7.0.0. Instead, either the [mysqli](https://www.php.net/manual/en/book.mysqli.php) or [PDO_MySQL](https://www.php.net/manual/en/book.pdo.php) extension should be used. See also the [MySQL API Overview](https://www.php.net/manual/en/mysqlinfo.api.choosing.php) for further help while choosing a MySQL API. – Dharman Jul 04 '19 at 17:27
  • What is the purpose of `global $membername, $memberjoindate, $membergroupno;`? Isn't this code already in global space? – Dharman Jul 04 '19 at 17:27
  • Thanks for the reply. I will change the sql accordingly. The same code was working as expected in static form. But when I used in while loop, Its not working. Please advise for a possible resolve. Thanks in advance. – keyem Jul 05 '19 at 14:43
  • I used mysql because i had an old version of wamp server and I dont want to update, atleast for some time, since I had some handfull working projects in it. – keyem Jul 05 '19 at 15:02
  • How old is that system? PHP 4? – Dharman Jul 05 '19 at 15:08
  • No its PHP 5.3.13 – keyem Jul 05 '19 at 17:58
  • Then you can keep PHP 5.3 but you should still migrate the code to use PDO or MySQLi extension. – Dharman Jul 05 '19 at 18:04
  • But this is'nt my real issue as of now. How can i re-work on the above code to get working? If i dont use the while statement, this piece of code work awsome. Please help me with the real issue – keyem Jul 07 '19 at 05:32

0 Answers0