Back Home

Open Designs

Community. Driven.

    •  
      CommentAuthorpogy366
    • CommentTimeJan 16th 2007
     
    just when i think i have the hang of PHP/MySQL it turns around and kicks me square in the....

    OK, rather than jerk around with importing an Excel spreadsheet into the db, i decided to create a form that i could use to directly add my info to the db (which will in turn be pulled out with PHP to create a web site).

    The problem now is that i can't seem to develop a simple HTML/PHP form that works (let alone does what i want). i've tried looking for something on the web or in the books that i have and for some reason i'm turning up nothing. angry

    Are there any PHP/MySQL gurus that could point me to a decent source explaining how to create a simple form to capture my info (just text) and send it to an existing MySQL table/db?

    Thanks!!!
    •  
      CommentAuthoryugnats
    • CommentTimeJan 16th 2007
     
    • CommentAuthorkoloa
    • CommentTimeJan 16th 2007
     
    if your interested, i can help you out with ruby rails mysql.
    •  
      CommentAuthoryugnats
    • CommentTimeJan 16th 2007 edited by yugnats on the 16th January 2007 at 09:08:25 EST
     
    •  
      CommentAuthorpogy366
    • CommentTimeJan 16th 2007 edited by pogy366 on the 16th January 2007 at 09:49:34 EST
     
    yugnats - thanks, i'll give that a shot. (the third link that is)

    kola - how "deep" is ruby rails? To be honest i haven't paid any attention to it so i'm not sure how it compares to PHP.
    • CommentAuthorkoloa
    • CommentTimeJan 16th 2007
     
    hi,
    well if you wanted to add a form to input something in the database, this is how you would do it in its simpliest version (freehanding code here!):

    #main program file
    def form
    @myform = MyTable.new
    end

    #form.rhtml file

    form_start :action => 'submitform'
    text field :myform, 'field1'
    text field :myform, 'field2'
    text field :myform, 'field3'
    ....
    submit_tag 'Submit'
    end_form

    #back in your main program file

    def submitform
    @mytemp = MyTable.new(params[:myform])
    @mytemp.save
    end

    # now your myTable contains all the fields you inputted in the form.

    hope this helps..
    • CommentAuthorkoloa
    • CommentTimeJan 16th 2007
     
    about how deep is RoR, that i am not sure. However, if you want to implement a new type of functionality to a site, it is easy as pie. if you have any questions, or would like to know how to add something to an exisitng site, i would be happy to help!