ddeo Posted December 13, 2006 Share Posted December 13, 2006 Hi, I am new to this forum and I am a Php/MySQL novice. I have searched this forum to similar issues but could not my paricular issue. This may be because I don't know exactly what the problem is.I just recently switched hosting providers and my scripts worked great on the old host. Now that I have moved to the new server I am having some weird issues posting data to the data base. I understand that there are diffierences in server configurations - eg: versions of PHP and MySQL, but my script is pretty basic. Esentiall it uploads a file (no problem) and puts some data into a table. But, only some of the data is written....Here are the server configs:Old Server: Apache/2.0.50 (FreeBSD)PHP Version 4.3.10MySQL 4.0.20New server: Apache/1.3.36 (Unix)PHP Version 4.4.4MySQL client version: 4.1.10The script below works except will not post the value for $pdf_title. Everything else is posted. Any help is greatly appreciated. Thanks, Ddeo[code]<?session_start();$table_name = 'writing';$title_name = 'Writing';$pageTitle = 'Upload Writing document - ';$title = 'Blah Blah';$click_trap = 'yes';include 'header.htm';if (isset($_SESSION['user'])=='ADMIN') { require_once ('../mysql_connect.php'); // Create the table $sql = "CREATE TABLE IF NOT EXISTS $table_name ( id int(11) NOT NULL auto_increment, pdf_file varchar(255) NOT NULL default '', pdf_title varchar(255) NOT NULL default '', type varchar(60) NOT NULL default '', size int(20) NOT NULL default '0', UNIQUE KEY id (id) ) TYPE=MyISAM AUTO_INCREMENT=10"; $create_table = mysql_query($sql) or die(mysql_error()); // define file extension $exten = ".pdf"; // define the base image dir $base_img_dir = "./pdf/"; // If the form was submitted, process it. $the_file = $_FILES['up_file']; //print_r ($the_file); $the_type = $the_file['type']; $the_size = $the_file['size']; if ($_POST['submit'] && $_POST['pdf_title'] && $the_file['name']) { // generate unique id for use in filename $uniq = uniqid(""); // new file name $filename = $base_img_dir.$uniq.$exten; $dfilename = $uniq.$exten; // move uploaded file to destination move_uploaded_file($_FILES["up_file"]["tmp_name"], $filename); // insert into db mysql_query("INSERT INTO $table_name (pdf_file, pdf_title, type, size) VALUES('$dfilename', '$pdf_title', '$the_type', '$the_size')") or die(mysql_error()); // display some information echo "<p>PDF uploaded</p>"; } else if ($_POST['submit'] && !$_POST['pdf_title'] && !$the_file['name']) { echo '<p>Please add a Title and a File</p>'; } else if ($_POST['submit'] && !$_POST['pdf_title'] && $the_file['name']) { echo '<p>Please add a Title</p>'; } else if ($_POST['submit'] && $_POST['pdf_title'] && !$the_file['name']) { echo '<p>Please add a File</p>'; } echo " <img src=\"title-wg.jpg\" width=\"233\" height=\"41\" alt=\"\"><br> <h2>Upload {$title_name} Document:</h2> <form enctype=\"multipart/form-data\" name=\"pdf_upload\" method=\"post\" action=\"{$_SERVER['PHP_SELF']}\"> <h3>Select file: <input name=\"up_file\" type=\"file\" size=\"30\"></h3> <h3>Title: <input name=\"pdf_title\" type=\"text\" size=\"60\"></h3> <!--Description: <textarea name=\"pdf_descr\" rows=\"\" cols=\"46\"></textarea>--> <input type=\"submit\" name=\"submit\" value=\"Upload\" size=\"30\" onClick=\"return DoubleClickTrapperAction();\"> </form> "; } else { echo '<a href="update.php">You must log in first!</a>';}include 'footer.htm';?>[/code] Link to comment https://forums.phpfreaks.com/topic/30500-script-worked-before-server-change/ Share on other sites More sharing options...
ddeo Posted December 13, 2006 Author Share Posted December 13, 2006 Hi, I just figured it out. The variable must look like this: {$_POST['pdf_file']} Link to comment https://forums.phpfreaks.com/topic/30500-script-worked-before-server-change/#findComment-140435 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.