Jump to content

ra2833

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ra2833's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. remember guys, i want to send a variable instead of an initial number. see image.php to understand what i mean. more info: depending on what the user will click, it will send a number to a variable, then that variable will travel through the entire site, and when i need the image to be displayed, then it is displayed. as it stands now, i would have to hard code "one" number and have th same picture come up all the time. index.php <?php require_once('Connections/faqSQLconn.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_faqSQLconn, $faqSQLconn); $query_faq_all = "SELECT * FROM faq WHERE faq.faq_unique_id"; $query_limit_faq_all = sprintf("%s LIMIT %d, %d", $query_faq_all, $startRow_faq_all, $maxRows_faq_all); $faq_all = mysql_query($query_limit_faq_all, $faqSQLconn) or die("Query failed: " . mysql_error() . " Actual query: " . $query_limit_faq_all); $row_faq_all = mysql_fetch_assoc($faq_all); $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1") && ($_FILES['uploadfilefield']['size'])) { if ($_POST['MAX_FILE_SIZE'] >= $_FILES['uploadfilefield']['size']) { $photo = addslashes(fread(fopen($_FILES['uploadfilefield']['tmp_name'], "rb"), $_FILES['uploadfilefield']['size'])); $query = sprintf("INSERT INTO faq_image(image, file_type, faq_unique_id, name) VALUES ('%s', '%s', '%s', '%s')", $photo, $_FILES['uploadfilefield']['type'], $_POST['image_id'], $_FILES['uploadfilefield']['tmp_name']); mysql_select_db($database_faqSQLconn, $faqSQLconn); $faq_image_result = mysql_query($query, $faqSQLconn) or die("Query failed: " . mysql_error() . " Actual query: " . $query); if ($faq_image_result) { $messages[] = "Your file is successfully stored in database"; } else { $messages[] = mysql_error(); } } else { $messages[] = "The file is bigger than the allowed size (96k) please reduce your file size"; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body> <form id="form1" name="form1" method="POST" enctype="multipart/form-data" action="<?php echo $editFormAction; ?>"> <?php if (isset($messages)) { foreach ($messages as $message) { print $message ."<br>"; } } ?> <input type="hidden" name="image_id" value="<? echo $row_faq_all['faq_unique_id'] + 1 ?>"/> <input type="file" name="uploadfilefield" /> <input type="hidden" name="MAX_FILE_SIZE" value="9600000" /> <input type="submit" name="Submit" value="Submit" /> <input type="hidden" name="MM_insert" value="form1" /> </form> </body> </html> <?php mysql_free_result($faq_all); ?> issue.results.php <?php require_once('Connections/faqSQLconn.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $faq_unique_id_r = intval($_GET['faq_unique_id_s']); mysql_select_db($database_faqSQLconn, $faqSQLconn); $query_faq_solution = "SELECT * FROM faq WHERE faq.faq_unique_id = '".$faq_unique_id_r."'"; $faq_solution = mysql_query($query_faq_solution, $faqSQLconn) or die("Query failed: " . mysql_error() . " Actual query: " . $query_faq_solution); $row_faq_solution = mysql_fetch_assoc($faq_solution); $totalRows_faq_solution = mysql_num_rows($faq_solution); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <meta http-equiv="Content-Type" content="image/gif; charset=iso-8859-1"> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body> <?php echo '<img '.$row['image'].' src="image.php?faq_unique_id_s='.$_GET['faq_unique_id'].'">'; ?> </body> </html> <?php mysql_free_result($faq_solution); ?> image.php <?php require_once('Connections/faqSQLconn.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $image_unique_id_rr = 130; mysql_select_db($database_faqSQLconn, $faqSQLconn); $query = "SELECT * FROM faq_image WHERE faq_image.image_unique_id = '".$image_unique_id_rr."'"; $faq_image_result = mysql_query($query, $faqSQLconn) or die("Query failed: " . mysql_error() . " Actual query: " . $query); $row = mysql_fetch_array($faq_image_result); header("Content-type: %s", $row['name']['type']); $im = imagecreatefromstring($row['image']); imagegif($im); imagedestroy($im); ?> i have attached the faq_for_6_1 database, you will have to rename them to .sql instead of .txt unless you do copy/paste of the content into mysql. i have verified that you can: 1. insert an image with index.php 2. you can the simply browse to issue.results.php 3. before you can see the picture you have to match what your database has for the unique id, and then place that number in image.php to see the picture so i have tried quite a few suggestions, but i have yet be able to use the code with this line in my image.php file: $faq_unique_id_r = intval($_GET['faq_unique_id_s']); [attachment deleted by admin]
  2. remember guys, i want to send a variable instead of an initial number. see image.php to understand what i mean. more info: depending on what the user will click, it will send a number to a variable, then that variable will travel through the entire site, and when i need the image to be displayed, then it is displayed. as it stands now, i would have to hard code "one" number and have th same picture come up all the time. index.php <?php require_once('Connections/faqSQLconn.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } mysql_select_db($database_faqSQLconn, $faqSQLconn); $query_faq_all = "SELECT * FROM faq WHERE faq.faq_unique_id"; $query_limit_faq_all = sprintf("%s LIMIT %d, %d", $query_faq_all, $startRow_faq_all, $maxRows_faq_all); $faq_all = mysql_query($query_limit_faq_all, $faqSQLconn) or die("Query failed: " . mysql_error() . " Actual query: " . $query_limit_faq_all); $row_faq_all = mysql_fetch_assoc($faq_all); $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1") && ($_FILES['uploadfilefield']['size'])) { if ($_POST['MAX_FILE_SIZE'] >= $_FILES['uploadfilefield']['size']) { $photo = addslashes(fread(fopen($_FILES['uploadfilefield']['tmp_name'], "rb"), $_FILES['uploadfilefield']['size'])); $query = sprintf("INSERT INTO faq_image(image, file_type, faq_unique_id, name) VALUES ('%s', '%s', '%s', '%s')", $photo, $_FILES['uploadfilefield']['type'], $_POST['image_id'], $_FILES['uploadfilefield']['tmp_name']); mysql_select_db($database_faqSQLconn, $faqSQLconn); $faq_image_result = mysql_query($query, $faqSQLconn) or die("Query failed: " . mysql_error() . " Actual query: " . $query); if ($faq_image_result) { $messages[] = "Your file is successfully stored in database"; } else { $messages[] = mysql_error(); } } else { $messages[] = "The file is bigger than the allowed size (96k) please reduce your file size"; } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body> <form id="form1" name="form1" method="POST" enctype="multipart/form-data" action="<?php echo $editFormAction; ?>"> <?php if (isset($messages)) { foreach ($messages as $message) { print $message ."<br>"; } } ?> <input type="hidden" name="image_id" value="<? echo $row_faq_all['faq_unique_id'] + 1 ?>"/> <input type="file" name="uploadfilefield" /> <input type="hidden" name="MAX_FILE_SIZE" value="9600000" /> <input type="submit" name="Submit" value="Submit" /> <input type="hidden" name="MM_insert" value="form1" /> </form> </body> </html> <?php mysql_free_result($faq_all); ?> issue.results.php <?php require_once('Connections/faqSQLconn.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $faq_unique_id_r = intval($_GET['faq_unique_id_s']); mysql_select_db($database_faqSQLconn, $faqSQLconn); $query_faq_solution = "SELECT * FROM faq WHERE faq.faq_unique_id = '".$faq_unique_id_r."'"; $faq_solution = mysql_query($query_faq_solution, $faqSQLconn) or die("Query failed: " . mysql_error() . " Actual query: " . $query_faq_solution); $row_faq_solution = mysql_fetch_assoc($faq_solution); $totalRows_faq_solution = mysql_num_rows($faq_solution); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <meta http-equiv="Content-Type" content="image/gif; charset=iso-8859-1"> <link href="style.css" rel="stylesheet" type="text/css"> </head> <body> <?php echo '<img '.$row['image'].' src="image.php?faq_unique_id_s='.$_GET['faq_unique_id'].'">'; ?> </body> </html> <?php mysql_free_result($faq_solution); ?> image.php <?php require_once('Connections/faqSQLconn.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $image_unique_id_rr = 130; mysql_select_db($database_faqSQLconn, $faqSQLconn); $query = "SELECT * FROM faq_image WHERE faq_image.image_unique_id = '".$image_unique_id_rr."'"; $faq_image_result = mysql_query($query, $faqSQLconn) or die("Query failed: " . mysql_error() . " Actual query: " . $query); $row = mysql_fetch_array($faq_image_result); header("Content-type: %s", $row['name']['type']); $im = imagecreatefromstring($row['image']); imagegif($im); imagedestroy($im); ?> i have attached the faq_for_6_1 database, you will have to rename them to .sql instead of .txt unless you do copy/paste of the content into mysql. i have verified that you can: 1. insert an image with index.php 2. you can the simply browse to issue.results.php 3. before you can see the picture you have to match what your database has for the unique id, and then place that number in issue.results.php to see the picture so i have tried quite a few suggestions, but i have yet be able to use the code with this line in my image.php file: $faq_unique_id_r = intval($_GET['faq_unique_id_s']); [attachment deleted by admin]
  3. Believe it or not, when i initialize my variable in "any" of my pages to a number (interger) i do get my image displayed on my final page. from index.php --> callimagetodsiplay.php --> retreiveimage.php if i initialize my variable ($blah=94) at index.php, and assign $blah to be received by callimagetodsiplay.php "and" retreiveimage.php my image is displayed if i initialize my variable ($blah=94) at callimagetodsiplay.php, and assign $blah to be received by retreiveimage.php my image is displayed this is what i have learned about single quotes vs. double quotes, but i am not quite sure about html tags, any all help that i have received is greatly appreciated. the idea is to have a certain link to be clicked by the user, and that perticular link will call from the database a perticular image. single quotes are upto 50% faster and do not get interpolated double quotes do get interpolated, which means that they evalutate the value of a php variable double quotes are required when you use the escape key like \n (newline) example 1 the value of this variable ($blue) will be copied into this new variable ($emc) $blue = 4; $emc = "$blue"; display will be 4; example 2 the string ($blue) will be copied into this new variable ($emc) $blue = 4; $emc = '$blue'; display will be $blue <?php $string1 = 'This string will not be interpolated\n<br />'; $string2 = 'Part of this string will be interpolated ' . "\n" . '<br />'; $string3 = "$string2"; $string4 = '$string1<br />'; $string5 = "This will be interpolated\n<br />"; echo $string1 . $string2 . $string3 . $string4 . $string5; ?> so i still need help in typing the correct syntax in which my stuipid variable will be evalutated to where i can display the image.........
  4. well, i have narrowed down my error to one variable in my code; callimagetodsiplay.php (this code works perfectly fine) <?php echo $output ="<img src="retreiveimage.php?image_unique_id_s=94">"; ?> retreiveimage.php <?php $image_unique_id_rr = intval($_GET['image_unique_id_s']); //if i was to initialize my variable here instead of on the calling page, it "too" works here; mysql_select_db($database_faqSQLconn, $faqSQLconn); $query = "SELECT * FROM faq_image WHERE faq_image.image_unique_id = '".$image_unique_id_rr."'"; $faq_image_result = mysql_query($query, $faqSQLconn) or die("Query failed: " . mysql_error() . " Actual query: " . $query); $row = mysql_fetch_array($faq_image_result); header("Content-type: %s", $row['name']['type']); $im = imagecreatefromstring($row['image']); imagegif($im); imagedestroy($im); ?> BUT MY HEADACHE IS HERE..... awwww .... when i want to send a variable instead of an number my code does not display the image awwww.. callimagetodsiplay.php <?php $faq_unique_id_r = intval($_GET['faq_unique_id_s']); //i have echo this and the correct number does come up ?> . . . <html> <?php echo $output ="<img src="image.php?image_unique_id_s='.$faq_unique_id_r.'" >"; ?> is it my syntax on ('.$faq_unique_id_r.') this small little section that will not evaluate???????, but when i do an echo on retreiveimage.php the number shows up??? what gives????
  5. well, i have made tremendous progress on this small project thanks to all of you who have helped..... Information: 1. i am able to upload a file as binary data to a database 2. i am able to retrieve all relevent information from the database 2.a like the name i gave the file 2.b like the size of the file 2.c like the unique identifer of the file 2.d like the type of file But, when i pull out the binary data from the database, i get stream of information on my screen instead of the image!!!!!! can someone help me out here: <?php //same connection structure to database as previous post (above) //$faq_unique_id_r = intval( $_GET['faq_unique_id_s'] ); $image_unique_id_r = 92; mysql_select_db($database_faqSQLconn, $faqSQLconn); $query = "SELECT * FROM faq_image WHERE faq_image.image_unique_id  = '".$image_unique_id_r."'"; $faq_image_result = mysql_query($query, $faqSQLconn) or die("Query failed: " . mysql_error() . " Actual query: " . $query); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> </head> <body> <?php $row = mysql_fetch_array($faq_image_result); echo $row['image_unique_id']; echo $row['name']; echo $row['file_type']; echo $row['image'];          <----- this does not print image ?> </body>
  6. thanks a million again, i had to add the [ b ] to the [r] this comes from php.net [b][font=Verdana]Warning [/font] [/b] On systems which differentiate between binary and text files (i.e. Windows) the file must be opened with 'b' included in fopen() mode parameter. <?php $filename = "c:\\files\\somepic.gif"; $handle = fopen($filename, "rb"); $contents = fread($handle, filesize($filename)); fclose($handle); ?> so my end result is: [code] $photo = addslashes(fread(fopen($_FILES['file']['tmp_name'], "rb"), $_FILES['file']['size'])); [/code] i no longer the error and it still works.... dude its a great morning...thanks a million all
  7. awesome awesome awesome....... thank you all for  the super fast feed back and brainstorming.... my page looks like #@$@#$ but i don't care cuz my data is being sent to the db absolutely correct.... thank you all again.. one almost last question: what should be the correct format for this line of code?  it works but IE tells me there is something wrong with it [code] $photo = addslashes(fread(fopen($_FILES['file']['tmp_name'], "r"), $_FILES['file']['size'])); [/code]
  8. well, the form with no action was my file upload, and that was working! here is my new edited code: [code] <div id="content_table" style="position:absolute; left:147px; top:137px; width:471px; height:259px; z-index:102"> <span class="style1">Create Issue:</span> <table width="475"  border="0" cellspacing="0" cellpadding="0"> <tr> <td> <form id="form1" name="form1" method="POST" enctype="multipart/form-data" action="<?php echo $editFormAction; ?>"> <table width="99%"  border="0" cellspacing="0" cellpadding="0"> <tr> <td>CRM Case#</td> <td><input type="text" name="crmcase"></td> <td width="24%">Client OS</td> <td width="27%"> <select name="client_os"> <?php do { ?> <option value="<?php echo $row_faq_client_version['client_version']?>"><?php echo $row_faq_client_version['client_version']?></option> <?php } while ($row_faq_client_version = mysql_fetch_assoc($faq_client_version)); $rows = mysql_num_rows($faq_client_version); if($rows > 0) { mysql_data_seek($faq_client_version, 0); $row_faq_client_version = mysql_fetch_assoc($faq_client_version); } ?> </select> </td> </tr> <tr> <td width="16%">Site Type</td> <td width="33%"> <select name="site_type"> <?php do {  ?> <option value="<?php echo $row_faq_site_type['site_type']?>"><?php echo $row_faq_site_type['site_type']?></option> <?php } while ($row_faq_site_type = mysql_fetch_assoc($faq_site_type)); $rows = mysql_num_rows($faq_site_type); if($rows > 0) { mysql_data_seek($faq_site_type, 0); $row_faq_site_type = mysql_fetch_assoc($faq_site_type); } ?> </select> </td> <td>Application:</td> <td> <select name="application"> <?php do {  ?> <option value="<?php echo $row_faq_application['Application']?>"><?php echo $row_faq_application['Application']?></option> <?php } while ($row_faq_application = mysql_fetch_assoc($faq_application)); $rows = mysql_num_rows($faq_application); if($rows > 0) { mysql_data_seek($faq_application, 0); $row_faq_application = mysql_fetch_assoc($faq_application); } ?> </select> </td> </tr> <tr> <td colspan="2"><br /></td> <td>Support/Tech</td> <td> <select name="tech"> <?php do {  ?> <option value="<?php echo $row_faq_tech['tech']?>"><?php echo $row_faq_tech['tech']?></option> <?php } while ($row_faq_tech = mysql_fetch_assoc($faq_tech)); $rows = mysql_num_rows($faq_tech); if($rows > 0) { mysql_data_seek($faq_tech, 0); $row_faq_tech = mysql_fetch_assoc($faq_tech); } ?> </select> </td> </tr> <tr> <td colspan="2">Issue/Question <textarea name="question"></textarea> </td> <td colspan="2">Answer/Resolution<br /> <textarea name="answer"></textarea> </td> </tr> <tr> <td colspan="2">&nbsp;</td> <td colspan="2"> <input type="submit" name="Submit" value="Submit" /> </td> </tr> <tr> <td colspan="2"</td> <td colspan="2">&nbsp;</td> </tr> </table> <!-- Begin Php for Photo  - when turned on this does not work --> <?php if ($_POST['Submit']) { if ($_POST['MAX_FILE_SIZE'] >= $_FILES['file']['size']) { $photo = addslashes(fread(fopen($_FILES['file']['tmp_name'], "r"), $_FILES['file']['size'])); $query = sprintf("INSERT INTO faq_image(image, file_type) VALUES ('%s', '%s')", $photo, $_FILES['file']['type']); mysql_select_db($database_faqSQLconn, $faqSQLconn); $faq_image_result = mysql_query($query, $faqSQLconn) or die("Query failed: " . mysql_error() . " Actual query: " . $query); if ($faq_image_result) { $messages[] = "Your file is successfully stored in database"; } else { $messages[] = mysql_error(); } } else { $messages[] = "The file is bigger than the allowed size (96k) please reduce your file size"; } } ?> <!-- end php for photo -->       </td> </tr> </table> <table width="99%"  border="0" cellspacing="0" cellpadding="0"> <tr> <td> <span class="style6"><? if (isset($messages)) { foreach ($messages as $message) { print $message ."<br>"; } } ?></span> <input type="file" name="file"> <input type="hidden" name="MAX_FILE_SIZE" value="96000"> <span class="style6">Add An Image</span> </td> </tr> </table> </form> <p> <br> </p> <!-- Begin Table return top 10 --> <table width="518"  border="0" cellspacing="0" cellpadding="0"> <tr> <td background="images/ci_head.jpg"> <br /> <br /> <br /> </td> </tr> <tr> <td background="images/ci_main.jpg"> <br /> <center>      <table width="475" border="0" cellpadding="0" cellspacing="0"> <tr class="darktable"> <td><strong>FAQ ID</strong></td> <td><a href="sort.by.crm.case.num.php" >CRM Case #</a></td> <td><a href="sort.by.question.php">Question</a></td> <td><a href="sort.by.answer.php">Answer</a></td> <td><a href="sort.by.tech.php">Technician</a></td> <td><a href="sort.by.site.type.php">Site Type</a></td> <td><a href="sort.by.client_os.php">Client OS</a></td> <td><a href="sort.by.answer.php">Application</a></td> </tr> <!-- Alternate row colors --> <tr> <?php $style = ""; $rowcolor1 = "#666666"; $rowcolor2 = "#cecece";  $alternatecolorcounter = 0; do { if ($alternatecolorcounter % 2 == 1) { $style = $rowcolor1;                                        } else { $style = $rowcolor2; } echo "\t<tr bgcolor=\"$style\">\n".        "\t\t<td>". $row_faq_all['faq_unique_id'] ."</td>\n". "\t\t<td>". $row_faq_all['crm_case_num'] ."</td>\n". "\t\t<td>". $row_faq_all['question'] ."</td>\n". "\t\t<td>". $row_faq_all['answer'] ."</td>\n". "\t\t<td>". $row_faq_all['tech'] ."</td>\n". "\t\t<td>". $row_faq_all['site_type'] ."</td>\n". "\t\t<td>". $row_faq_all['client_os'] ."</td>\n". "\t\t<td>". $row_faq_all['application'] ."</td>\n". "\t</tr>\n"; $alternatecolorcounter++; } while ($row_faq_all = mysql_fetch_assoc($faq_all)); ?> </tr> </table> </center> </td> </tr> <tr> <td background="images/ci_footer.jpg"> <br /> <br /> </td> </tr> </table> <p>&nbsp;</p> <!-- Begin Search --> <form id="form2" name="form2" method="get" action="faq.search.php?search=true"> <label>Keyword: <input type="text" name="searchfaqkeyword" /> </label> <label> <input type="submit" name="Submit2" value="Search" /> </label> </form> </div> </body> </html> <?php [/code]
  9. okay, well my file goes into my db but my textarea items do not, i guess i'l have to work on this.... is it possible to have multiple forms with the same name?
  10. well, the only reason i think i need two forms is becasue: i have two different type of "type" items my first form has this: (no enctype) [code] <form id="form1" name="form1" method="post" action="<?php echo $editFormAction; ?>"> [/code] and my second form has this: (no action) [code] <form id="form3" name="form3" method="post" action=""  enctype="multipart/form-data"> [/code] would i be okay in combining this two forms to form this?: [code] <form id="form3" name="form3" method="post" action=""  enctype="multipart/form-data" action="<?php echo $editFormAction; ?>"> [/code] well, i am going to test this and see if this works...
  11. Hi (plz let me know if you need more code), what i would like to accomplish is have one button that will send all of my form information to the db i understand that i can "not" embed <form> tags but how do i go about combining two different forms with one submit button? i have attempt "if" statements but i can't seem to get to work.  any help is greatly appreciated: i have this: [code] <form id="form1" name="form1" method="post" action="<?php echo $editFormAction; ?>"> [\code] and this: [code] <form id="form3" name="form3" method="post" action=""  enctype="multipart/form-data"> [\code] here is a bigger snip of my code: [code] if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) { $insertSQL = sprintf("INSERT INTO faq (crm_case_num, question, tech, application, client_os, site_type, answer) VALUES (%s, %s, %s, %s, %s, %s, %s)",       GetSQLValueString($_POST['crmcase'], "text"),       GetSQLValueString($_POST['question'], "text"),       GetSQLValueString($_POST['tech'], "text"),       GetSQLValueString($_POST['application'], "text"),       GetSQLValueString($_POST['client_os'], "text"),       GetSQLValueString($_POST['site_type'], "text"),       GetSQLValueString($_POST['answer'], "text")); mysql_select_db($database_faqSQLconn, $faqSQLconn); $Result1 = mysql_query($insertSQL, $faqSQLconn) or die(mysql_error()); } <form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>"> <table width="99%"  border="0" cellspacing="0" cellpadding="0"> <tr> <td>CRM Case#</td> <td><input type="crmcase" name="crmcase"></td> <td width="24%">Client OS</td> <td width="27%"> <select name="client_os"> <?php do { ?> <option value="<?php echo $row_faq_client_version['client_version']?>"><?php echo $row_faq_client_version['client_version']?></option> <?php } while ($row_faq_client_version = mysql_fetch_assoc($faq_client_version)); $rows = mysql_num_rows($faq_client_version); if($rows > 0) { mysql_data_seek($faq_client_version, 0); $row_faq_client_version = mysql_fetch_assoc($faq_client_version); } ?> </select> <input type="submit" name="Submit" value="Submit" /> </td> <input type="hidden" name="MM_insert" value="form1" /> [\code] and [code] <?php if ($_POST['Submit']) { if ($_POST['MAX_FILE_SIZE'] >= $_FILES['file']['size']) { $photo = addslashes(fread(fopen($_FILES['file']['tmp_name'], "r"), $_FILES['file']['size'])); $query = sprintf("INSERT INTO faq_image(image, file_type) VALUES ('%s', '%s')", $photo, $_FILES['file']['type']); mysql_select_db($database_faqSQLconn, $faqSQLconn); $faq_image_result = mysql_query($query, $faqSQLconn) or die("Query failed: " . mysql_error() . " Actual query: " . $query); if ($faq_image_result) { $messages[] = "Your file is successfully stored in database"; } else { $messages[] = mysql_error(); } } else { $messages[] = "The file is bigger than the allowed size (96k) please reduce your file size"; } } ?> </form> </td> </tr> </table> <table width="99%"  border="0" cellspacing="0" cellpadding="0"> <tr> <td> <span class="style6"><? if (isset($messages)) { foreach ($messages as $message) { print $message ."<br>"; } } ?> </span> <form action="" method="post" enctype="multipart/form-data" name="form3"> <input type="file" name="file"> <input type="hidden" name="MAX_FILE_SIZE" value="96000"> <input type="submit" name="Submit" value="Submit"> <span class="style6">Add An Image</span> </form> [\code][/code][/code][/code][/code]
  12. thanks man, that was soooo freaking quick (awesome).... here is what i ended up with [code] <?php $style = ""; $rowcolor1 = "#8A3324"; $rowcolor2 = "#00B2EE"; $alternatecolorcounter = 0; do { if ($alternatecolorcounter % 2 == 1) { $style = $rowcolor1; } else { $style = $rowcolor2; } echo "\t<tr bgcolor=\"$style\">\n". "\t\t<td>". $row_faq_all['faq_unique_id'] ."</td>\n". "\t\t<td>". $row_faq_all['crm_case_num'] ."</td>\n". "\t\t<td>". $row_faq_all['question'] ."</td>\n". "\t\t<td>". $row_faq_all['answer'] ."</td>\n". "\t\t<td>". $row_faq_all['tech'] ."</td>\n". "\t\t<td>". $row_faq_all['site_type'] ."</td>\n". "\t\t<td>". $row_faq_all['client_os'] ."</td>\n". "\t\t<td>". $row_faq_all['application'] ."</td>\n".             "\t</tr>\n"; $alternatecolorcounter++; } while ($row_faq_all = mysql_fetch_assoc($faq_all)); ?> [/code]
  13. i gather information from previous threads, but i can't seem to find out what my problem is in regards to this piece of code.  can someone shed some light please? [code] <table width="480" border="0" cellpadding="0" cellspacing="0"> <tr class="darktable"> <td><strong>FAQ ID</strong></td> <td><a href="sort.by.crm.case.num.php" >CRM Case #</a> </td> <td><a href="sort.by.question.php">Question</a></td> <td><a href="sort.by.answer.php">Answer</a></td> <td><a href="sort.by.tech.php">Technician</a></td> <td><a href="sort.by.site.type.php">Site Type</a></td> <td><a href="sort.by.client_os.php">Client OS</a></td> <td><a href="sort.by.answer.php">Application</a></td> </tr> <?php $style = " "; ?> <?php $rowcolor1 = "#F0F0F2"; ?> <?php $rowcolor2 = "#FFFFFF"; ?> <?php $alternatecolorcounter = 0; ?> <?php do { ?> <?php if ($alternatecolorcounter % 2 == 1) { $style = $rowcolor1; } else { $style = $rowcolor2; } ?> <tr> <td style="background:'.$style.'"><?php echo $row_faq_all['faq_unique_id']; ?></td? </tr> <?php $alternatecolorcounter++ ?> <?php } while ($row_faq_all = mysql_fetch_assoc($faq_all) && $alternatecolorcounter <= $totalRows_faq_all); ?> </table>[/code]
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.