I solved my problem. I didn't realize I wasn't referencing the correct
variable names.

On Dec 22, 5:36 pm, Big Moxy <[EMAIL PROTECTED]> wrote:
> Ultimately I want this form to upload a file to a server location
> based on the additional form fields on the server. I started with
> sample code that I found querying jquery file upload. Originally
> echo.php contained two var_dump statements - one for $_POST and the
> other for $_FILES. That works fine and echos the data back in the
> output div on the form page.
>
> Once I got the form working as intended I replaced the var_dump
> statements with explicit references to the $_POST variables. The
> problem now is that I cannot reference the $_POST variables explicitly
> (e.g. $_POST['clientID']).
>
> Can someone please tell me what is wrong?
>
> Thank you!
> Tim
>
> Test URL using echo.php shown below is 
> -http://projects.missioninternet.com/proweb/admin/test.php.
> Test URL using echo1.php with var_dump statements 
> -http://projects.missioninternet.com/proweb/admin/test1.php.
>
> My current echo.php is copied below the form code.
>
> form page code excerpt:
>
> <script type="text/javascript" src="../scripts/jquery/
> jquery-1.2.1.js"></script>
> <script type="text/javascript" src="../scripts/jquery/
> jquery.blockUI.js"></script>
> <script type="text/javascript" src="../scripts/firebug/firebug.js"></
> script>
> <script type="text/javascript" src="../scripts/jquery/
> jquery.form.js"></script>
> <script type="text/javascript">
> $(function() {
>     $('form').ajaxForm({
>         beforeSubmit: clearOutput,
>         success:      writeOutput
>     });
>
> });
>
> $().ajaxError(function(ev, opts, xhr, msg, ex) {
>     //window.console.error(msg + ': ' + ex);
>     alert(msg + ': ' + ex);
>
> });
>
> // blockUI activity indicator
> $.extend($.blockUI.defaults.overlayCSS, { backgroundColor:
> '#E6E6E6' });
> $.blockUI.defaults.pageMessage = '<img src="../images/loading.gif" />
> Running...';
> $().ajaxStart($.blockUI).ajaxStop($.unblockUI);
>
> // pre-submit callback
> function clearOutput(a, f, o) {
>     $('#output').empty();
>
> }
>
> // success callback
> function writeOutput(data) {
>     var $out = $('#output');
>     $out.append('<div><pre>'+ data +'</pre></div>');}
>
> </script>
> </head>
> <body>
> <form id="test1" action="echo.php" method="POST" enctype="multipart/
> form-data">
> <?php
>     echo "<select name='targetClient' tabindex='1'>";
>         echo "<option value=''>Select client</option>";
>         $sql = "SELECT `clientID`, `companyName` FROM " . $clientsTable
>                         . " WHERE `clientID` <> 1 ORDER BY `companyName`";
>         $result = mysql_query($sql) or die(mysql_error());
>         while ($row = mysql_fetch_assoc($result)) {
>                 echo "<option value='"
>                         . $row['clientID']
>                         . "'>"
>                         . $row['companyName']
>                         . "</option>";
>         }
>     echo "</select><br>";
> ?>
> <select name="docType" tabindex="2">
> <option value="">Select Type of Document</option>
> <option value="invoices">Invoice</option>
> <option value="reports">Report</option>
> </select>
> <input type="hidden" name="MAX_FILE_SIZE" value="100000" />
> <input type="file" name="fileName" tabindex="3"><br>
> <input name="upload" type="submit" value="Upload File"
> tabindex="4"><br>
> </form>
> <div id="output"></div>
>
> echo.php:
>
> <?php
> $clientID = $_REQUEST['clientID'];
> require_once('../Connections/prowebDB.php');
> $sql = "SELECT `companyName` FROM " . $clientsTable
>                 . " WHERE `clientID` = " . $clientID;
> echo "sql = " . $sql . "<br>";
> $result = mysql_query($sql) or die(mysql_error());
> $row = mysql_fetch_assoc($result);
> echo basename($_FILES['userfile']['name']) . "was copied to " .
> $row['companyName'] . " " . $_POST['docType'];
> mysql_free_result($result);
> ?>

Reply via email to