0

Maybe it's a stupid question so I will not write a lot..

I have an index.php file with two Jquery Mobile pages each has a form passing variables a function with php_self which inserts datas into Mysql tables. Each form has a table with the latest inserted datas next to it. But the first page's form's table was refreshed only, if I used the second page's form, I needed to push the browser's refresh button to see the latest datas.

I was advised to use data-ajax="false" in the form tags. This worked but the sites lost the css formatting because it redirected the pages to a strange address. For example the original address is mysite.com/index.php#page2 with the data-ajax="false" it will be mysite.com//index.php#page2 or similar. I use the latest stable Jquery Mobile with CDN. Thanks for the answers.

Andras
  • 109
  • 1
  • 1
  • 7
  • 2
    This is not clear what is wrong or not working. When you use `data-ajax="false"`, the form data is posted without using AJAX. So it will be much like one would expect when following a link in a common web page. Whatever page is being posted to, `index.php` for example will need to re-load all the CSS and JS for jQuery Mobile to retain the styling and activities. Not writing too much will backfire in this case, since we will need more info to help you. – Twisty May 25 '16 at 23:56
  • 1
    You really need to clarify your question better. include some samples of the forms, and the javascript, and a sample response object from the php target. It sounds like your javascript may simply be referencing the wrong html elements (duplicate IDs?), or you are using the same object for both forms (configuring for the second form overwriting the configuration for the first one - use `new`). – Tony Chiboucas May 26 '16 at 00:20

2 Answers2

0

Thanks for the comments that were useful so I find the solution with your help:

  1. There were several divs in the page with the same id. I rewrote them.
  2. The Forms had not their own ids so I added.
  3. I added data-ajax="false" to the form elements.
  4. (!!!) I Removed the action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>" from the form element

So everythig worked. I feel the Jquery Mobile and the Php5 don't like each other really.

Andras
  • 109
  • 1
  • 1
  • 7
0

I had a similar problem with not submitting to POST array. Textarea and hidden submitted successfully. When I removed elements from the form, all variables submitted successfully. Insane.