Check for duplicates and submit

EDIT: I am using Code Igniter: www.codeigniter.com

So I'm new to web developement and programming in general and I've been playing around with PHP and started developing a little website and i want to make it easier for users to submit.

I have 9 radio buttons (oh and I'm using code igniter)

    <?php
    echo form_radio('name1', '3')." 3 ";
    echo form_radio('name1', '2')." 2 ";
    echo form_radio('name1', '1')." 1 ";
    echo form_radio('name2', '3')." 3 ";
    echo form_radio('name2', '2')." 2 ";
    echo form_radio('name2', '1')." 1 ";
    echo form_radio('name3', '3')." 3 ";
    echo form_radio('name3', '2')." 2 ";
    echo form_radio('name3', '1')." 1 ";
    $submit = Array ("name" => 'submit', "value" => 'Submit', "class" => "g-button large");
    echo form_submit($submit);
    echo form_close();
    ?>

So i want something to check for duplicates and display an error (preferable a div) without reloading the page and i would also like the form to submit without the submit button (for example hotornot.com but with 3 sets of radio buttons).

I understand this needs jQuery and possibly AJAX (?) and i'm completely clueless with them both. And also i saw this: http://jquery.malsup.com/form/ and i tried tinkering with it but i had nfi what i was doing.

Answers


You don't need to use every helper in CI; I wouldn't use form helper, at least for the radio buttons as you'll need to include onClick event handler into radio button html code:

<input type="radio" name="name1" value="3" onclick="set_info('send_something')" />
<div id="info">&nbsp;</info>

this part should be put between tags in your html code, above radio buttons of course:

<script type="text/javascript">
set_info=function(send_something){
$('#info').html(send_something);
}
</script>

the last one includes jQuery code of course and you sould include it too:

<script type="text/javascipt" src="jquery.js"></script>

I hope that this code snippets give you more than basic idea where your coding should go for this case.


Need Your Help

Hidden fields are missing while doing 'view source'

java html jsp

I have two hidden fields in my jsp form. When i get the page in browser and do 'view source', I could see only the first hidden field, not the second field.

Php error log not working correctly

php apache error-log

i have error in my page but it is not logs in to the log file

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.