SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict dgroves's Avatar
    Join Date
    Jan 2007
    Location
    Bath, UK
    Posts
    364
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Submitting form data with jQuery

    Hi all,

    I was wondering if anyone would be able to help me out here. I have written a script using PHP to allow a user a project I am working on to upload a file into a MySQL database using PHP.
    I would now like to improve on this script, ideally using jQuery as I have used in the past. I would like to be able to submit the upload and show a success overlay without forcing the user to leave the page.

    I have Googled around and only succeeded in confusing myself, it would be great if anyone could help me out here.

    My form that I need to submit the contents of is below.
    Code HTML4Strict:
    <h2>File Upload</h2>  
     
    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data" id="fileUpload">
     
    	<div>
    		<label for="upload">Upload File</label>
    		<input type="file" name="upload" id="upload" />
    	</div>
    	<div>	
    		<label for="desc">File Description</label>
    		<input type="text" name="desc" maxlength="225" id="desc" />
    	</div>
    	<div>
    		<label for="url">Site URL</label>
    		<label for="url" class="sameline">http:// </label><input type="text" name="url" maxlength="200" id="url" />
    	</div>
     
    	<div class="buttons">
    		<input type="submit" id="submit" value="Upload" class="upload" />
    	</div>
     
    </form>


    Any help would be awesome!

    Thanks,
    Dan.

  2. #2
    Pedantic Semantic blain's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you don't want to reload the page, but want to submit data to a database, you're gonna need to look at the Ajax section of the jQuery site.
    http://docs.jquery.com/Ajax
    Technology is dominated by two types of people:
    those who understand what they do not manage,
    and those who manage what they do not understand.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •