Jump to content

Kelset

Members
  • Posts

    29
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Kelset's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok not sure if this is right spot for this, I'm sorry if it it. I have session that work great on my test server (WAMP5) the move from page to page like they should. When I put them up on live server they don't seem to work? any idea's what might be wrong? Thank you for your help in this for me Stephen
  2. Works perfectly thanks for all your guys help, I am once again in debt to you have phpfreaks help pages :) I hope one day to return the favor! Cheers! Stephen
  3. Thanks for the information guys but when I run the fucntion I get an error. Call to undefined function celi() any idea why I am getting this? I figured it out should be ceil() Stephen
  4. Ok I have an array that I page through, I pass the current page throug the URL. What I am having trouble with is finding what the last page would be. First I count the number of items in the array, I then divied that by 10 (number of items showing per page) and round it. This method does not seem to be working, any ideas? cheers! Stephen
  5. Name all the checkboxes the same and then loop through them to see what ones have been checked. Name them all something like this [code] <INPUT TYPE='checkbox' NAME='cat[]' value='hotel'> <INPUT TYPE='checkbox' NAME='cat[]' value='bars'> <INPUT TYPE='checkbox' NAME='cat[]' value='restaurants'> [/code] This will put all the checkboxes into an array when form is submitted, array name being cat. On the page where you want the checkbox ticked you just use a for loop. [code] if(in_array("hotel",$cat)) {     $hotel_check = "checked"; }else{     $hotel_check = ""; } if(in_array("bars",$cat)) {     $bars_check = "checked"; }else{     $bars_check = ""; } if(in_array("restaurants",$cat)) {     $restaurants_check = "checked"; }else{     $restaurants_check = ""; } [/code] Then have the checkbox HTML look something like this [code] <INPUT TYPE='checkbox' NAME='cat[]' value='hotel' <?PHP echo $hotel_checked; ?>> <INPUT TYPE='checkbox' NAME='cat[]' value='bars' <?PHP echo $bars_checked; ?>> <INPUT TYPE='checkbox' NAME='cat[]' value='restaurants' <?PHP echo $restaurants_checked; ?>> [/code] This is just from the top of my head and nothing is tested, I'm sure there is a better way to do the if statments but i'm new. Sorry for not being able to optomized better but like I said I'm a newb :) Hope I was of some help Cheers! Stephen
  6. Just a quick stab in the dark here and I'm new but should this line contain the filename? [code] $upload_file_path = $_POST["filedirectory"] . $_POST["filename"]; [/code] The path for the file to be uploaded should not have the file name in it right? not sure Cheers! Stephen
  7. When they login I have a check user page that sets a bunch of stuff. Once of those things is the session for hold an array. I defined it just by doing this. $_SESSION['five']; Should I do it like this $_SESSION['five'] = array(); Thanks for the help Stephen
  8. I'm sorry :( Ok the error I'm getting is this. Warning: in_array() [function.in-array]: Wrong datatype for second argument in G:\wamp\www\littlecreations\display.php on line 38 Line 38 is if (in_array($five[$i], $sess_five)){ any ideas why I'm getting this error? says that it is wrong type but $sess_five is an array as far as I know. I set the session when they login to be empty $_SESSION['five'] should it be set different way? Thank you for you time in this for me Cheers! Stephen
  9. Ok i'll just post my code and see what you guys think, here is what I'm trying to do frist. The user log in to the images display page, image for that user is dispalyed and each image has a checkbox with the name of five. They select the images they would like to keep they hit a form button called "Add Image". This code fires when that button is hit, there is some paging of images and stuff but this is all I think needs to be shown. [code] //Convert session array into easy to use var $sess_five = $_SESSION['five']; //Store checkbox array in var for easy use $five = $_POST['five']; //This will be an array from checkboxes //check to see if any photos have been checked //Get number of checkboxs checked if (!empty($five)) {     //count how many images in each array $five_count = count($five);     //loop through each array and see if the value is already stored in it for ($i=0;$i<$five_count;$i++) { if (in_array($five[$i], $sess_five)){ echo " YOU HAVE ONE"; // Just some testing text }else{ //add to session var $sess_five .= $five[$i]; }//End if }//End for }//End if //Store the array back into a session $_SESSION['five'] = $sess_five; [/code] any help would be great! cheers! Stephen
  10. Kelset

    Form help

    No I use the page for displaying and storing the arrays Cheers! Stephen
  11. Kelset

    Form help

    ok I have a PHP array that displays images and I only show 10 at a time. Each image has three checkboxes for three different sizes. The paging I do works fine but it is not submitting the form so the checkbox arrays are not being sent. So what I am doing now is letting them check the sizes of the current images display and having them use the from submit button. Once they hit the button the images are loading into a session array and the next set of images is displayed. Is there a better way to do this? Just wondering. Cheers! stephen
  12. Not sure what you are looking for here, do you want all the information in one row for each record? The code above puts the information into three rows. I a very new to PHP but this is something that I might do, code is not tested. [code] <?php //Start row count at 0 $row_count = 0; //Start your table echo"<TABLE border ='1'><TR>\r"; while($row = mysql_fetch_array($query, MYSQL_ASSOC)) { //Check row_count to see if there should be a new table row made or and col. if ($row_count < 2) { //See if there are no more records, if not put in the blank col. if ($row['img_url'] == "") { echo "<td></td>\r"; }else{ echo "<td width=\"320px\"><a href=\"".$row['img_url']>"\" target=\"_blank\"><img src=\"">$row['img_url']."\" height=\"200\"/></a></td>"; echo "<td width=\"150px\">".$row['full_name']."</td>"; echo "<td width=\"150px\">".$row['description']."</td>"; } //Increment row_count by 1 $row_count++;   }else{   if ($row['img_url'] == "") { echo "<td></td></tr><tr>"; }else{ echo "<td width=\"320px\"><a href=\"".$row['img_url']>"\" target=\"_blank\"><img src=\"">$row['img_url']."\" height=\"200\"/></a></td>"; echo "<td width=\"150px\">".$row['full_name']."</td>"; echo "<td width=\"150px\">".$row['description']."</td>";         echo"</TR><tr>\r"; }     // $row_count = 0;   } } ?> [/code] Hope that helps you out in some way Cheers! Stephen
  13. Only thing I can think of is to add the NOT NULL at the end of you query. $sql = "ALTER TABLE `character` CHANGE `character` `description` varchar(255) NOT NULL"; not sure if that helps any but  I tried Cheers! Stephen
  14. If you have the DB made all you do in PHPMyAdmin is hit the insert tab at the top. Then insert the numbers you want to use in the numer colum. Cheers! Stephen
  15. Here is a function that I have found and use, it gets all the images from a directory and passes it back as an array. You can then loop through the array and make your link or what have you. function getImagesList($path) {     $ctr = 0;     if ( $img_dir = @opendir($path) ) {         while ( false !== ($img_file = readdir($img_dir)) ) {             // can add checks for other image file types here             if ( preg_match("/(\.gif|\.jpg)$/", $img_file) ) {                 $images[$ctr] = $img_file;                 $ctr++;             }         }         closedir($img_dir);         return $images;     }     return false; } cheers! Stephen
×
×
  • 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.