Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery UI dialog form - Missing variable values
    primarykey
    data
    text
    <p>On my website I am making a dialog form with the jQuery ui framework.</p> <p>The dialog requests a topic, review content, name and city which should be inserted into mySQL. However when I want to pass the variables to PHP there is no value in the variables.</p> <p>Here is the entire js function that handles the dialog:</p> <pre><code>$( "#dialog-form" ).dialog({ autoOpen: false, height: 600, width: 550, modal: true, buttons: { "Skriv Review": function() { var bValid = true; allFields.removeClass( "ui-state-error" ); bValid = bValid &amp;&amp; checkLength( topic, "topic", 3, 16 ); bValid = bValid &amp;&amp; checkLength( review, "review", 1, 10000 ); bValid = bValid &amp;&amp; checkLength( name, "name", 1, 25 ); bValid = bValid &amp;&amp; checkLength( city, "city", 1, 16 ); bValid = bValid &amp;&amp; checkRegexp( name, /^[a-z]([0-9a-z_])+$/i, "Bruger skal være a-z, 0-9, underscores, begynde med et bogstav." ); if ( bValid ) { $( "#users tbody" ).append( "&lt;tr&gt;" + "&lt;td&gt;" + topic.val() + "&lt;/td&gt;" + "&lt;td&gt;" + review.val() + "&lt;/td&gt;" + "&lt;td&gt;" + name.val() + "&lt;/td&gt;" + "&lt;td&gt;" + city.val() + "&lt;/td&gt;" + "&lt;/tr&gt;" ); var data = { topic: topic.val(), review: review.val(), name: name.val(), city: city.val() } $.ajax({ type : 'POST', url : 'bruger-reviews.php', dataType : 'json', data: data, success : function(data){ //success } }); $( this ).dialog( "close" ); } }, Cancel: function() { $( this ).dialog( "close" ); } }, close: function() { allFields.val( "" ).removeClass( "ui-state-error" ); } }); </code></pre> <p>And here is how I receive the data in PHP:</p> <pre><code>$ins_topic = $_POST['topic']; $ins_review = $_POST['review']; $ins_name = $_POST['name']; $ins_city = $_POST['city']; </code></pre> <p>I have no issue displaying the values like it is done in the demo from jQuery UI.</p> <p>There is no data when I $_GET or $_POST the variables. Why is it not possible for me to pass the values to PHP? Is there another method I can try?</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload