PHP - Zip Multiple Items With Check Box [hellp]
Hello need some help
keep getting Code: [Select] [function.readfile]: failed to open stream: No such file or directory in code im use Code: [Select] // Ziper function zipFilesAndDownload($file_names,$archive_file_name,$file_path){ $zip = new ZipArchive(); //create the file and throw the error if unsuccessful if ($zip->open($archive_file_name, ZIPARCHIVE::CREATE )!==TRUE) { exit("cannot open <$archive_file_name>\n"); } //add each files of $file_name array to archive foreach($file_names as $files) { $zip->addFile($file_path.$files,$files); } $zip->close(); $zipped_size = filesize($archive_file_name); header("Content-Description: File Transfer"); header("Content-type: application/zip"); header("Content-Type: application/force-download");// some browsers need this header("Content-Disposition: attachment; filename=$archive_file_name"); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); header("Content-Length:". " $zipped_size"); ob_clean(); flush(); readfile($archive_file_name); unlink($archive_file_name); // Now delete the temp file (some servers need this option) exit; } if(isset($_POST['formSubmit'])) { //$file_names=$_POST['items'];// Always sanitize your submitted data!!!!!! //$file_names = filter_var_array($_POST['items']);//works but it's the wrong method $filter = filter_input_array(INPUT_POST, FILTER_SANITIZE_SPECIAL_CHARS) ; $file_names = $filter['items'] ; //Archive name $archive_file_name = 'images.zip'; //Download Files path $file_path= getcwd(). ''.$baseurl.'/cinema/'; //cal the function zipFilesAndDownload($file_names,$archive_file_name,$file_path); } html Code: [Select] <form method="post"> <input type="checkbox" name="items[]" value=" href="{$baseurl}/data/images/s/{$filename}"/> </form> Please help Similar TutorialsI have say about 7 different interests and beside each interest I want a check box. How would I go about having multiple check boxes checked so I can remove however many interests at one time... For example: [Checked] Hockey Soccer Baseball [Checked] Basketball And the remove all selected button would remove the checked interests. Thanks, Sean Hello: I want to create a feedback form that will allow a user to select from 30 or so items on a page, and send the data to an email address. I think it's something like a shopping cart but without a need to process a payment. I want to list items (like a soccer ball, a basket ball, etc.) and allow the user to select the size of the ball, the color, the number of balls, etc. I want the user to be able to select 1 item or many items. Once they are done, they would hit submit, and the data would get sent to an email address. Do I need to use a session to do this? I was trying to work with this code: Code: [Select] <?php session_start(); session_register('product'); session_register('amount'); $_SESSION['product'] = $_POST['product']; $_SESSION['amount'] = $_POST['amount']; //SEND THE EMAIL CODE HERE ???? ?> <form method="post" action=""> <input type="text" size="10" name="product"><br /> <input type="text" size="10" name="amount"><br /> <input type="submit" value="Finish"> </form> But I'm pretty sure I'm not in the ballpark on how to do this. Anyone have any ideas? Thanks in advance. I have the following session variables for each item in a cart, which gets updated each time an item is added from the catalog // Register the session variables $_SESSION['ses_basket_items']=$ses_basket_items; $_SESSION['ses_basket_name']=$ses_basket_name; $_SESSION['ses_basket_amount']=$ses_basket_amount; $_SESSION['ses_basket_price']=$ses_basket_price; $_SESSION['ses_basket_stockcode']=$ses_basket_stockcode; $_SESSION['ses_basket_image']=$ses_basket_image; $_SESSION['ses_basket_size']=$ses_basket_size; $_SESSION['ses_basket_sizechoice']=$ses_basket_sizechoice; $_SESSION['ses_basket_id']=$ses_basket_id; I have a current cart page which loops through the sessions and displays them in a form. I have a check box for each item with the name="remove[]" and the value is the itemID which is the $ses_basket_id of item in the session. I have a select box with name="size[]" and the value is the users selected size for each item in the session which is $ses_basket_size Finnally I have a quantity text box with name="quantity[]" and the value is the users quantity value selected which is $ses_basket_amount. After all the looping through the products displaying each item in a row I have an update cart submit button name="change" outside the loop. What I want to know is how do I setup to perform each of these actions for each item in the session, how do I create the foreach loops for each array to delete or modify the correct items in the session if they are modified. I have the code to perform each task but dont know how to loop it through for each item in the session affecting only the correct session items. so if I have 3 items in the session for example, and I want to change the size of item 1, remove item 2 and change item 3 for quantity 1 to quantity 3 with only the 1 form and change button for all items and actions? Hope that makes sense any help with this would be appreciated. What i trying to do is make search with multiple check boxes here is may error im get Code: [Select] Please try again later or contact an Administrator. (1064) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Inner Join rasta_cinema_categories AS r ON cat = r.cat WHERE upper() LIKE'%%'' at line 2 SELECT `video_id`, `name`, `description`, `video_name`, `thumb_image`, `release`, `cat`, `format`, `imbd_url`,`added`, `recomended` ,`sticky`, `owner`, `clicks` FROM `rasta_cinema` AS Inner Join rasta_cinema_categories AS r ON cat = r.cat WHERE upper() LIKE'%%' and here is the code Code: [Select] $searching = (isset($_POST['searching']) ? $_POST['searching'] : ''); if ($searching =="yes") { $paieska = (isset($_POST['find']) ? $_POST['find'] : ''); if ($paieska == "") { $klaida = '<div class="error" id="show_error">You forgot to enter a search term</div>'; } $checkbox = $_POST['cat']; if ($checkbox !='') { $extra = " and `cat` IN(". explode(', ',$checkbox) . ")"; } $cinema = ''; $filmai = $TSUE['TSUE_Database']->query("SELECT `video_id`, `name`, `description`, `video_name`, `thumb_image`, `release`, `cat`, `format`, `imbd_url`,`added`, `recomended` ,`sticky`, `owner`, `clicks` FROM `rasta_cinema` AS Inner Join rasta_cinema_categories AS r ON cat = r.cat WHERE upper($field) LIKE'%$paieska%'".$extra); $numrows = mysqli_num_rows($filmai); if($numrows == 0) { $klaida = '<div class="error" id="show_error">Nothing found</div>'; } while ($row = mysqli_fetch_array($filmai)) { $cinema_row = ''; $id = $row['video_id']; $name = $row['name']; $description = $row['description']; $video_name = $row['video_name']; $thumb = $row['thumb_image']; $release = $row['release']; $format = $row['format']; $imbd_url = $row['imbd_url']; $cat = $row['cat']; $owner = $row['owner']; $clicks = $row['clicks']; $data = date('Y-m-d H:i:s',$row['added']); $nujo = $row['recomended']; $sticky = $row['sticky']; $free = ""; if ($row['recomended'] == 1){ $free = '<img title="Recomended" src="/cinema/images/heart.png"/>'; } $sticky = ""; if ($row['sticky'] == 1){ $sticky = '<img title="Sticky" src="/cinema/images/pin.png"/>'; } $recomended = ''; $recomended = $free.$sticky; eval("\$cinema_row = \"".$TSUE['TSUE_Template']->LoadTemplate('cinema_row')."\";"); $cinema .= $cinema_row; } } This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=357483.0 Hello im just beginner on this side. Here what im trying to do but not successful Code: [Select] SELECT m.memberid, p.memberid, p.uploaded, p.downloaded, p.total_posts, p.invites_left, p.points FROM tsue_members m, tsue_member_profile p WHERE p.memberid=m.memberid query work but i want to get memberid diferent for every member Say im logged im see my stats user logged hes see hes stats. Thanks Hello im geting this error what im ding wrong? Code: [Select] PHP Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in /home/admincom/public_html/tsue/library/plugins/movie_plugin.php on line 7 line 7 is: while ($row = mysqli_fetch_array($sql)) { code he Code: [Select] $query = mysqli_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DB); $sql = mysqli_query($query, "SELECT `membername`, `filename`, `tid`, `info_hash`, `name`, `description`, `cid`, `size`, `added`, `leechers`, `seeders`, `times_completed`, `owner`, `options`, `nfo`, `sticky`, `flags`, `mtime`, `ctime`, `download_multiplier`, `upload_multiplier` FROM `tsue_members`, `tsue_torrents`, `tsue_attachments` WHERE `memberid`='owner' AND `content_type`='torrent_images' AND `content_id` = `tid` LIMIT 0, 10"); while ($row = mysqli_fetch_array($sql)) { $movie_plugin_row = ''; $uploader = $row['membername']; $description= $row['description']; $dydis= $row['size']; $name= $row['name']; $leechers= $row['leechers']; $owner= $row['owner']; $filename= $row['filename']; $nunx= $row['tid']; $seeders= $row['seeders']; eval("\$movie_plugin_row = \"".$TSUE['TSUE_Template']->LoadTemplate('movie_plugin_row')."\";"); $movie_plugin .= $movie_plugin_row; } I have a form with multiple options to fill out (its a admin form) i want to make sure only one of the of the options are set, so im checking if the variable is empty with if ($variable1 != NULL) { $new_variable = "yep, this option was filled out"; } so if the form sent anything from the form with the value 'variable1' it then sets a new variable ($new_variable) Problem is i have multiple fields so i need to make sure if it finds a a variable is not empty, then too check if the others have anything in them too. If it does find another (meaning more than one has been filled out) echo an error (echo "you must only complete one option..") What is the best way to check if more than one variable exists? Sorry if i explained it complicated. Thank you Hi, How can i check if a string is a multiple of 0.1 without anything being left over? like 1.6 = true, 1.46 = false Is it possible to have multiple check boxes on a single form and a single submit button tp post the values into different rows of DB Kenny Hi, I have multiple table Table -1 order_no name 1 raj table -2 order_no name 1 raj table 3 order_no name 1 raj table 4 order_no name 1 raj table 5 order_no name 1 raj I want a query to check if the id (one) is present in all tables or not, i create this. select order_no from prepress, press, postpress, qc, binding, dispatch where order_no=prepress.order_no AND order_no=press.order_no AND order_no=postpress.order_no AND order_no=qc.order_no AND order_no=binding.order_no AND order_no=dispatch.order_no but the ambiguous error for order_no. how to achieve this can anyone suggest me? thanks Hi all, i've got a string ($currentcatid) which contains one number which changes dependant on which page the visitor is on.. ie it may be perhaps "23" or "17" . I need to do a check against this string to see if it contains any of the following values .. 31,32, 1, 24 . I cant remember how i did it before but i think it was with pipes.. something along the lines of if ($currentcatid =="31"||"32"||"1"||"24") { action } can anyone help? Thanks I have displayed check box values(ugroup field) from ugroups table.now what i want to do is,when user select multiple check boxes and submit it should be insert into relavent feild in table.now it's insert check boxes values.but not in relevant field.this is my code.Please help me.
//select ugroup's from group table. <?php $result = "SELECT id,ugroup FROM group"; $res_result = db::getInstance()->query($result); ?> <form action="db_sql/db_add_page.php" method="get"> Tittle :<input type="text" size="100" name="tittle" /> Description :<textarea cols="80" id="editor1" name="description" rows="10"></textarea> //Display ugroups in textboxes and checkboxes <?php while( $line=$res_result->fetch(PDO::FETCH_ASSOC)) { echo '<input type="checkbox" name="group[]" value=" '. $line['ugroup'] .'" />'; echo'<input type="text" name="ugroup" disabled="disabled" value=" '. $line['ugroup'] .'" size="7" "/>'; echo ' '; } ?><input type="submit" value="Submit"> </form>db_add_page.php if(isset($_POST)) { $tittle = $_POST['tittle']; $description = $_POST['description']; $ugroup = $_POST['group']; $acc_status = "INSERT INTO add_services (id,tittle,description,g1,g2,g3,g4,g5,g6,g7,g8) VALUES(NULL,'".$tittle."','".$description."','".$ugroup[0]."','".$ugroup[1]."','".$ugroup[2]."',' ".$ugroup[3]."','".$ugroup[4]."','".$ugroup[5]."','".$ugroup[6]."','".$ugroup[7]."')"; $rate = db::getInstance()->exec($acc_status); if(!$rate){ echo '<script type="text/javascript">alert("Update Error !");</script>'; }else{ header('Location:../add_page.php'); echo '<script type="text/javascript">alert("Successfuly Updated User Group !");</script>'; } }Attached Files group.jpg 22.14KB 0 downloads add_services.jpg 21.36KB 0 downloads Hey guys, Really dumb question, but I want to check if a bunch of variables are all not empty. Then, if they aren't, I want to execute a mySQL query. Right now I have this which I know is wrong because it doesn't work the right way: Code: [Select] if($album != null || $artist != null || $year != null || $genre != null) { // stuff here... } Obviously I want all of those variables to be checked if they are empty or not. I did a quick Google and found that checking if the variables are null wouldn't be the correct way of solving this situation because an "empty string" is still not null? Anyway, any help would be appreciated. I'm pretty sure it's really simple :p. I'm making a checklist. One table holds the list with IDs. There are about 224 rows, each with its own ideas. Now I have another table to hold user accounts. When you create an account, it shows you a fresh new checklist that you need to start checking off. Could anyone please share techniques so I can have multiple accounts have their own list they need to check off? (ie, when a new person creatures a new account they should have their own list with NOTHING checked) The only way I can think of doing this is making 224 fields for the user account with the IDs of the checklist table to check if I checked it or not. Surely there's an easier way? Thanks Hi, I need help to check multiple rows for many columns, so that the script won't re-insert a duplicate entry. For eg: $isRowExist=mysql_query("SELECT (field1,field2) from table1 WHERE field1='$f1' AND field2='$f2' "); if(mysql_num_rows($isRowExist)==1) print "already in table1!"; else //proceed to insert into table table1 *BUT I tried this and it says mysql_num_rows expects resource, and this warning only shows when I have multipel columns I want to compare (it works just fine with one column in the WHERE clause above) Please help! I have a webpage where all the database items are displyes in a table format.The table also has a check box.Upon clicking the delete button i need to delete all the items whish has the checkbox checked. How will i do that As the title says, how can i check if multiple arrays exist inside an array or not? Any help is greatly appreciated!
I am attempting to submit a form that includes multiple check boxes for one data field. I have set it up the implode the data and make it a comma delimited array. I am able to echo the results, yet I have not been able to post the information to the database. I believe that I have just one simple thig to do, yet I am not being successful. Here is my code I have attached the .txt file also: <?php require_once('Connections/rotarysantarosa.php'); ?> <?php if (isset($_POST['submit'])) { if (isset($_POST['currentClubPosition'])) { $strcurrentClubPosition = implode(",", $_POST['currentClubPosition']); } else { $strcurrentClubPosition = ""; } } ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $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; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "frmMemberInsert")) { $insertSQL = sprintf("INSERT INTO members (firstName, lastName, photo, pastPresident, currentClubPosition, classification, workPosition, company, workAddress, workCity, workState, workZip, officePhone, fax, homePhone, cellPhone, email, website, homeAddress, homeCity, homeState, homeZip, birthdayMonth, birthdayDay, spouse, yearJoined) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['firstName'], "text"), GetSQLValueString($_POST['lastName'], "text"), GetSQLValueString($_POST['photo'], "text"), GetSQLValueString($_POST['pastPresident'], "text"), GetSQLValueString($_POST['currentClubPosition'], "text"), GetSQLValueString($_POST['classification'], "text"), GetSQLValueString($_POST['workPosition'], "text"), GetSQLValueString($_POST['company'], "text"), GetSQLValueString($_POST['workAddress'], "text"), GetSQLValueString($_POST['workCity'], "text"), GetSQLValueString($_POST['workState'], "text"), GetSQLValueString($_POST['workZip'], "text"), GetSQLValueString($_POST['officePhone'], "text"), GetSQLValueString($_POST['fax'], "text"), GetSQLValueString($_POST['homePhone'], "text"), GetSQLValueString($_POST['cellPhone'], "text"), GetSQLValueString($_POST['email'], "text"), GetSQLValueString($_POST['website'], "text"), GetSQLValueString($_POST['homeAddress'], "text"), GetSQLValueString($_POST['homeCity'], "text"), GetSQLValueString($_POST['homeState'], "text"), GetSQLValueString($_POST['homeZip'], "text"), GetSQLValueString($_POST['birthdayMonth'], "text"), GetSQLValueString($_POST['birthdayDay'], "int"), GetSQLValueString($_POST['spouse'], "text"), GetSQLValueString($_POST['yearJoined'], "int")); mysql_select_db($database_rotarysantarosa, $rotarysantarosa); $Result1 = mysql_query($insertSQL, $rotarysantarosa) or die(mysql_error()); $insertGoTo = "members.php"; if (isset($_SERVER['QUERY_STRING'])) { $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?"; $insertGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $insertGoTo)); } mysql_select_db($database_rotarysantarosa, $rotarysantarosa); $query_rsStates = "SELECT * FROM states ORDER BY stateName ASC"; $rsStates = mysql_query($query_rsStates, $rotarysantarosa) or die(mysql_error()); $row_rsStates = mysql_fetch_assoc($rsStates); $totalRows_rsStates = mysql_num_rows($rsStates); mysql_select_db($database_rotarysantarosa, $rotarysantarosa); $query_rsMemberInsert = "SELECT * FROM members ORDER BY lastName ASC"; $rsMemberInsert = mysql_query($query_rsMemberInsert, $rotarysantarosa) or die(mysql_error()); $row_rsMemberInsert = mysql_fetch_assoc($rsMemberInsert); $totalRows_rsMemberInsert = mysql_num_rows($rsMemberInsert); mysql_select_db($database_rotarysantarosa, $rotarysantarosa); $query_rsClubPosition = "SELECT * FROM clubpositions ORDER BY `Club Position` ASC"; $rsClubPosition = mysql_query($query_rsClubPosition, $rotarysantarosa) or die(mysql_error()); $row_rsClubPosition = mysql_fetch_assoc($rsClubPosition); $totalRows_rsClubPosition = mysql_num_rows($rsClubPosition); mysql_select_db($database_rotarysantarosa, $rotarysantarosa); $query_rsClassification = "SELECT * FROM classifications ORDER BY Classification ASC"; $rsClassification = mysql_query($query_rsClassification, $rotarysantarosa) or die(mysql_error()); $row_rsClassification = mysql_fetch_assoc($rsClassification); $totalRows_rsClassification = mysql_num_rows($rsClassification); mysql_select_db($database_rotarysantarosa, $rotarysantarosa); $query_rsBirthMonth = "SELECT * FROM birthdaymonth"; $rsBirthMonth = mysql_query($query_rsBirthMonth, $rotarysantarosa) or die(mysql_error()); $row_rsBirthMonth = mysql_fetch_assoc($rsBirthMonth); $totalRows_rsBirthMonth = mysql_num_rows($rsBirthMonth); mysql_select_db($database_rotarysantarosa, $rotarysantarosa); $query_rsBirthDay = "SELECT * FROM birthdayday ORDER BY birthdayday ASC"; $rsBirthDay = mysql_query($query_rsBirthDay, $rotarysantarosa) or die(mysql_error()); $row_rsBirthDay = mysql_fetch_assoc($rsBirthDay); $totalRows_rsBirthDay = mysql_num_rows($rsBirthDay); ?> |