Jump to content

hansford

Members
  • Posts

    562
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by hansford

  1. check your $_POST var ie: $_POST['body'] b/c I ran function input_text and it gives me correct results
  2. <form name="uploadform" enctype="multipart/form-data" method="post" action=<?php $_SERVER[php_SELF] ?>> Choose a file to upload:<input type="file" name="file01"/><br> <input type="submit" value="submit" name="action"/> </form> <?php if(isset($_FILES['file01'])) { $fil = $_FILES['file01']['name']; if($_POST["action"] == "submit"){ if(file_exists($_FILES['file01']['tmp_name'])) { $upload = $_FILES['file01']['tmp_name']; $filepath = $_SERVER['DOCUMENT_ROOT'] ."/images/" . $_FILES['file01']['name']; try { $err = move_uploaded_file($upload, $filepath); } catch(EXCEPTION $e) { echo $e; } } } } else { echo "upload failed"; } } $imgpath = "images/your_image_original.jpg"; $thumbpath = "thumbs/your_image_small.jpg"; $img = imagecreatefromjpeg($imgpath); $percent = 0.20; list($imgwidth,$imgheight) = getimagesize($imgpath); $newimgwidth = $imgwidth * $percent; $newimgheight = $imgheight * $percent; $newimage = imagecreatetruecolor($newimgwidth, $newimgheight); imagecopyresampled($newimage, $img,0,0,0,0,$newimgwidth, $newimgheight, $imgwidth, $imgheight); imagejpeg($newimage, $thumbpath,100); ?> mod edit - code tags added
  3. Daeeem - those super moderator are good!!! I know.. I know.. thats why they call you super.
  4. $count = 0; while($row = mysql_fetch_array($result)) { if($count < 7){ echo $row['name'] . " " . $row['title'] . " " . $row['date']; } else{ echo $row['name'] . " " . $row['title'] . " " . $row['date'] . " " . $row['info']; $count = 0; } count++; }
  5. What I mean by this is these 2 statements are not contained in a form. So thats why the $_POST for these 2 are null; $category_lists ='Category List' .BuildCategory(); $countrylist = 'Country' . BuildCountry();
  6. what appears to be happening is you're echoing out BuildCountry() and BuildCategory() outside of the form.
  7. this function call - BuildCategory() returns a complete <select> dropdown no problems there. this function call - BuildInputForm() should echo out whatever BuildCategory() returned. We need to see the missing code for BuildInputForm() where it does the acutal echoing.
  8. I stand corrected. I tested it and I'll be D...! my appologies.
  9. you can code this yourself. When you do your query from the DB. It would be something like this. $query = "SELECT * FROM users WHERE idealmatch = 'female' AND ages = '20-23' AND height = '5-3 to 5-9' etc.. You would probably want linking tables as this would be a bit much for one table, but you get the idea. Then when the results come up empty for some poor slob. You just re-query the DB dropping off one by one whatever his/her ideal is until you find him/her a match! hehe
  10. But it does make a difference. Consider a drop down list named 'year' $_POST['year'] will return --> Array if we selected from that dropdown list '2008' then $_POST['year'] will return --> Array and $_POST['year'][0] will return --> 2008
  11. I can help you with doing it the javascript way or php. the php way must be submitted as it needs to be in a $_POST var only those radios that were checked will be in the $_POST. The javscript way is a pain-I mean real pain. You must iterate through the entire form skipping anything thats not a radio button. checking if the radios checked and then keep track of all the other radios that have the same name that weren't checked. Heres an example that I did for another person in javascript. It checks a few other things, but the point is still the same - to get all the values of the selected radios. At the end of the script the answers are stroed in var str. this gets passed to a hidden element in the form to php in the $_POST which explodes("&", $str) to get the results in an array. --------------------------------- <form name='examform' method='post' action='index.php'> <input type='hidden' name='page' value='2'/> <input type='hidden' name='answer' value='hh'/> 1.)which is not a plant?<br><br>Tree<input type='radio' name='1' value='tree'/> <br>Spore<input type='radio' name='1' value='spore'/><br> Poppy<input type='radio' name='1' value='poppy'/><br><br> 2.)how many centimeters in an inch?<br><br> 2.0<input type='radio' name='2' value='2.0'/> <br>3.35<input type='radio' name='2' value='3.35'/><br> 2.56<input type='radio' name='2' value='2.56'/><br><br> 3.)which is not a name from the bible?<br><br> Larry<input type='radio' name='3' value='larry'/> <br>Joseph<input type='radio' name='3' value='joseph'/><br> Mary<input type='radio' name='3' value='mary'/><br> David<input type='radio' name='3' value='david'/><br><br> <input type='button' value='submit answers' name="action" onclick='validate(this.form)'> </form> <script language='javascript'> function validate(frm){ var answers = new Array(); var count = 0; for(var i=2; i < frm.length - 1;i++){ var missedarray = new Array(); var count2 = 0; var missedname = new Array(); var missed = 0; var question = frm.name; while(frm.name == question){ if(frm.checked){ missedarray[count2++] = 0; answers[count++] = frm.value; } else{ missedarray[count2++] = 1; } i++; } for(m = 0; m < missedarray.length; m++){ if(missedarray[m] == 0){ missed = 0; break; } else{ missed = 1; continue; } } if(missed){ var str = ""; alert('A question was missed. Please review your answers'); return; } i += - 1; } var str = ""; for(var i=0; i < answers.length;i++){ str += answers + "&"; } frm[1].value = str; frm.submit(); } </script>
  12. show us the values your passing for arguments type & id. Heck show us all the values you're passing.
  13. doh! forgot to add the i var --------------------------- var box = document.form[0]; var el = ""; for(var i=0; i < box.length;i++){ if(box.name == 'music_fan'){ if(box.checked){ el = box.value; break; } } } if (document.forms[0].musician_name.value == "" && el == '1')
  14. var box = document.form[0]; var el = ""; for(var i=0; i < box.length;i++){ if(box.name == 'music_fan'){ if(box.checked){ el = box.value; break; } } } if (document.forms[0].musician_name.value == "" && el == '1')
  15. $category_lists = $_POST['category_lists'][0]; this will be what was selected
  16. mine was just an example for you to use to learn how to get the correct option value-the way you have it now means nothing. If you try and call the function on the submit button then the page will be submitted and your function will never fire. you can try-although not necessarily cross-browser friendly- to add a button instead of the submit. <input type='button' value='submit' onclick='check_music(this.form);'> then you can submit the form by frm.submit(); --------------------------- If you never want this function to submit the form then you'll need to use a different handler ie: onchange
  17. yeah place it at the bottom of the page before </html> otherwise the elements arent fully loaded and you'll get errors
  18. i don't know exactly what youre trying to do -you'd probably want an onchange event handler here. I suppose when the user selects from a dropdown box -you'd call this function ----------------------------- let me know if this is not what youre looking for --------------------------- <form name='form1' method='post' action='mextpage.html'> <select name='music_fan' onchange='check_music(this.form);'> <option value='1'>1</option/> <option value='2'>2</option/> <option value='3'>3</option/> </select><br> <input type='text' name='musician_name' size='30'/><br> <input type='submit' value='submit'/> </form> <script language="JavaScript" type="text/javascript"> <!-- function check_music(frm) { if (frm.music_fan.options[frm.music_fan.selectedIndex].value== 1 && frm.musician_name.value == "") { frm.music_fan.focus(); } return; } //--> </script>
  19. what you need to do is store the name of the file in the DB and store the actual image in your image directory. The following code will grab a <input type='file' name='file01'> file and save it in your 'images' directory. A connection to your database will grab the image name, width and height - no need for a type here as the filename ie: img01.jpg already holds that info. ------------- if(isset($_FILES['file01'])) { $fil = $_FILES['file01']['name']; if(file_exists($_FILES['file01']['tmp_name'])) { $upload = $_FILES['file01']['tmp_name']; $filepath = $_SERVER['DOCUMENT_ROOT'] ."/images/" . $_FILES['file01']['name']; try { $err = move_uploaded_file($upload, $filepath); } catch(EXCEPTION $e) { echo $e; } } } else { echo "upload failed"; } ------------------ now the file is saved in a directory on your server ------------------------------------- now connect to your DB and grab the file name ie: $user[content] ----------------------------- then display the image -------------------- $img = $user[content]; $w = $user[width]; $h = $user[height]; echo "Photo: " . "<img src='/images/" . $img . "' width='" . $w . "' height='" . $h . "'>";
  20. this --> $access_mode = $arg['scrpr']; should just be --> $access_mode = $arg;
  21. $img = $user[content]; echo "Photo: " . "<img src='/upload/" . $img . "'>";
  22. $img = $user[content]; echo "Photo: " . "<img src='/upload/" . $img . "'>";
  23. I don't think the file is getting uploaded. try this.. $filepath = $_SERVER['DOCUMENT_ROOT'] ."/images/" . $_FILES['file01']['name']; $upload = $_FILES['file01']['tmp_name']; $err = move_uploaded_file($upload, $filepath); then make your DB connection and save it in $user[content]
×
×
  • 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.