Page 1 of 1

Dynamic HTML/PHP/MySQL Form

Posted: Wed Jul 11, 2007 6:58 pm
by coool
Hi everyone,

I really need a help.. I feel kind of lost somewhere ! .. I have a deadline on this coming Monday.. - 4 days left :(

2 forms at the same page
__________________________
Form 1:

I have a list called available_fields, it has the name of my table's columns in the database - I already retrieve the content of this list from my [s]databse[/s] database (multiple selection can be done here)

now I need a button that moves the selected items from my available_ fields list TO selected_fields list.. also a button to do the opposite (move back the elements)

now! what's in the selected_fields list should be used later in a MySQL query as fields of my result table
__________________________
Form 2

I should have a counter here of number of conditions (criterias) of our query
I have a drop down list that have (AND) (OR) .. logic !
I have a drop down list of brackets such as ( (( ((( (((( (((((
I have a drop down list with all fields again ( but a dropDownList not a list ) - one selection only
I have a drop down list of comparisions such as ( = != InList NotInList .. etc )
I should have a list of values of the exact field selected ( this is a dependent list on which field has been selected)
I have a drop down list of brackets such as ) )) ))) )))) )))))
then a botton allowing the user to delete the condition
at the end of this form there should be a button to add another criteria (condition)

now! the result of this form should be used later in a MySQL query as conditions on my result table
__________________________
then I should have something like this:
SELECT _ _ -result of form 1 _ _ FROM tableName WHERE _ _ result of form 2_ _)
at the end I should display the result of this query in a different page
__________________________
[s]plz[/s] please help!

at lease.. I need a small clear example..

P.S. I have a pic of the form I need to program.. but could not attached it here.. send me an email (co.ooo.ol@hotmail.com) if you want to see it.. I can e-mail you the form picture..
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:11. Please use proper, complete spelling when posting in the forums. AOL Speak, leet speak and other abbreviated wording can confuse those that are trying to help you (or those that you are trying to help). Please keep in mind that there are many people from many countries that use our forums to read, post and learn. They do not always speak English as well as some of us, nor do they know these aberrant abbreviations. Therefore, use as few abbreviations as possible, especially when using such simple words.

Some examples of what not to do are ne1, any1 (anyone); u (you); ur (your or you're); 2 (to too); prolly (probably); afaik (as far as I know); etc.

Posted: Wed Jul 11, 2007 10:47 pm
by Zoxive
Looks like a "Please do this for me" more then a
coool wrote:I really need a help
We are not here to do your work for you, especially school work.

We are here to help, so please post the code you are having problems with, and with errors/comments on what is not working correctly.

And images, you can always use imageshack

Posted: Wed Jul 11, 2007 11:02 pm
by coool
okay ! .. let's start step by step..

the first forum..

I've reached to this point and stoped ! ..

I didn't know how to move items from one table to another and move them back !!

having in mind that the moved items should be used later in a MySQL query as fields of my result table

here's the code:

Code: Select all

<?php
     <style type="text/css">
       #list { width: 200px;}
     </style>
      <br/>
      <h1>First Form</h1>
      <form name="form_1">
        <table width="100%">
          <tr>
            <td nowrap>Available Fields</td>
            <td>&nbsp;</td>
            <td nowrap>Selected Fields</td>
            <td>&nbsp;</td>
            <td rowspan=2 align="center" valign="bottom">
              <input type="reset" value="Clear Form">
            </td>
          </tr>
          <tr>
            <td width="20%">
              <select size="20" id="list" multiple name="available_fields">
//Instead of the below 4 lines, I use mysql query that selects all feilds of my database table
//just to make it simple here, I've used html php only without MySQL
<option value=\"item_1">Item 1</option>
<option value=\"item_2">Item 2</option>
<option value=\"item_3">Item 3</option>
<option value=\"item_4">Item 4</option></select>
            </td>
            <td width="20%" align="center" valign="center" nowrap>
              <input type="button" id="button" name="add" value=" move forward >>">
              <br><br>
              <input type="button" id="button" name="remove" value="<< move backward">
            </td>
            <td width="20%">
              <select size="20" id="list" multiple name="selected_fields">
              </select>
            </td>
          </tr>
        </table>
      </form>
?>
please 8) , help :roll: !

Posted: Wed Jul 11, 2007 11:07 pm
by coool
here's an image of a form I'm planning to code :)

http://img502.imageshack.us/my.php?image=formfb7.jpg

Posted: Wed Jul 11, 2007 11:23 pm
by coool
oh by the way, the code above isn't php.. it's only a plain html