Hello i try to post some data in a php form with jQuery modal box
My js
$( "#dialog-form" ).dialog({
autoOpen: false,
height: 500,
width: 650,
modal: true,
buttons: {
Envoyer: function() {
$('form#leaveReq').submit();
return true;
},
Ok: function() {
$( this ).dialog( "close" );
}
}
});
My Html
My html and php ( i use Code Igniter)
<div id="dialog-form" title="Create new user">
<?php $attributes = array('id' => 'leaveReq');
echo form_open('school/parents/addevent', $attributes); ?开发者_运维问答>
<p class="validateTips">Veillez remplire tous les champs</p> <br/>
<fieldset>
<label for="name"><b>Date de l'évènement</b> </label> <br/>
<select id="message">
<option>Volvo</option>
<option>Saab</option>
<option>Mercedes</option>
<option>Audi</option>
</select>
<label for="email">Nature du probleme</label> <br/>
<select>
<?php
foreach ($behaviours as $item):?>
<option><?=$item['name'];?></option>
Description du problème At W3Schools you will find all the Web-building tutorials you need, from
echo $text = $this->input->post('text');
echo $message = $this->input->post('message');
nothing work
look for what @BrandonS said about your names
You NEED attach your modal into your form. try use this:
open: function (type, data) {
// include modal into form
$(this).parent().appendTo($("form:first"));
},
Do it using ajax. It's easily done in codeigniter.
Put the form (+ submit button) in an iframe and wrap the iframe with the jquery-UI dialog. No matter what, you need to post page (or else you do it in ajax);
All of your code isn't here so I am not sure, but first make sure that all helpers and libraries in codeigniter are loaded i.e. form helper.
Also if this is your code then you have a few problems:
- In your form elements you need a "name" attribute, so that post has a key to go with the value. right now you have no post elements named message only an ID named message.
- You have a name label but no name field
Maybe this was just a quick post and you left things out but if not you need to re-read how HTML forms work, basically we can't help you if we don't have all the relevant code.
精彩评论