0

i have error for submitting form using javascript. the error said unknown column array. what is wrong with my array or maybe on my javascript.

this is my sample code.

<form action="">
    <input type="text" name="name">
    <input type="text" name="age">

    <input type="button"onClick="this.form.action='<?php echo site_url('core')?>/'+'add_name';this.form.submit();" value="new"/>
</form>
2
  • What does echo site_url('core'); return ? Seems like it's returning an array Commented Aug 27, 2013 at 8:25
  • site_url is for localhost? or like base_url ? Commented Aug 27, 2013 at 8:26

1 Answer 1

1

WORKING WITHOUT JS
Try this:

<?php
$frmAttrs  = array("id"=>"addFrm");
echo form_open('core/add_name', $frmAttrs);
?>
<input type="text" name="name">
<input type="text" name="age">

<!-- <input type="button" onClick="this.form.action='<?php //echo site_url('core/')?>'+'add_name';this.form.submit();" value="new"/> -->
<input type="button" id="submitFrm" onClick="this.form.submit();" value="new" />
</form>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.