hi, so i didnt know how to phrase this question in google to get some clue so im just gonna ask here. And im also not sure if this is the correct place to ask because im not sure what language id have to use.
anyway, i have a popup form which i did using js from a tutorial i found on the web. On the form users need to fill in event name, venue, date time and a theme input box which is connected to a checkbox, meaning that if the checkbox is checked users can type in the input box if it is not checked then the input box is readonly. So the thing im wondering is say if the user did not check the checkbox how do i default it that when the user clicks save the theme data is "NO"?

i hope i explained it well. if not heres the screenshot of my form and also some codes.

<script type="text/javascript">
           $(document).ready(function ()
              $("#popupevent").click(function (e)

              $("#cancel").click(function (e)


           function ShowDialog(modal)

                  if (modal)
                     $("#overlay").click(function (e)

               function HideDialog()


<div id="dialog" class="web_dialog">
    <form name="create">
        <fieldset style="width:350px;">
            <legend>Create Event</legend>
            Event Name  :  <input type="text" name="event_name" required/></br>
            Type of event : <select style="verticle-align:top" name="event_type"><option value="" disabled selected>Choose type</option><option value="anniversary">Anniversary</option>
            <option value="wedding">Wedding</option><option value="conference">Conference</option>
            Date : <input type="date" name="event_date" required/></br>
            Time : <input type="time" name="event_time" required/></br>
            Venue : <input type="text" name="event_venue" required/></br>
            Dresscode : <input type="text" name="event_code" required/></br>
            Theme : <input type="text" name="theme" disabled/> <input type="checkbox" name="check" onclick="enable()" />YES</br>
            <p style="float:right;"><input type="submit" name="save" id="save" value="Create Event" /><input type="submit" id="cancel" name="cancel" value="Cancel" /></p>


Recommended Answers

All 4 Replies

also to add to that when i click save(i inputed all) it does not save into the database. why?

require "connection.php";


    $create = mysql_query("INSERT INTO ems VALUES('$e_type','$e_name','$e_date','$e_time','$e_venue','$e_code','$e_theme')");



common error on line 47
<form name="create">
that should be
<form name="create" method="POST">

oh right. dang. its been awhile. forgot that. thanks. any ideas on my main prob?

So the thing im wondering is say if the user did not check the checkbox how do i default it that when the user clicks save the theme data is "NO"?

Include a conditional statement in your code and see if the "check" was included in the post.
You can check the value and if its not "Yes" then store the value of "No" in your variable.

In your PHP code you are going through all of the posted values except for this one checkbox?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.