Jump to content

quelle

Members
  • Posts

    61
  • Joined

  • Last visited

    Never

Everything posted by quelle

  1. I would really appreciate some help here, not actually with php but html. Whatever dimensions i put on my table row it doesn't change, the width stays as long as it can write "Ime" and next line "stranice". But in dreamweaver while im previewing it, its different, why !? :s <table width="848" border="0"> <form id="form" name="form" action="#" method="post" onsubmit="return validate_form();"> <tr bgcolor="#FFFF00"> <td width="35%" align="right">Ime stranice</td> <td width="65%"><input type="text" name="pagetitle" /></td> </tr> <tr bgcolor="#33CCCC"> <td align="right">Linklabel</td> <td><input type="text" name="linklabel" /></td> </tr> <tr bgcolor="#CCFFFF"> <td align="right" valign="top">Sadrzaj stranice</td> <td><textarea cols="100" rows="15" name="pagebody"></textarea></td> </tr> <tr> <td> </td> <td height="21"><input name="button" type="submit" value="Napravi" /></td> </tr> </form> </table>
  2. what actually does it mean NULL and look at this, for example i could take a variable from a form on both ways if($_POST['name']) { is same like this ? if(isset($_POST['name'])) {
  3. Actually what's the difference between if(...) and if(isset(...)
  4. Im having a php file with buttons in root directory, so im asking is it possible to make a function that will check whether we are accessing it from (for ex.) root/blabla/index.php or root/index.php so it can display 1 of 2 different forms
  5. OMG I've totally lost my mind the problem is i was calling the function twice damn
  6. Lets take for example line 136 function makeThumb($file, $type) { It says im missing those 2 arguments, but i dont really get it
  7. Here's what u will do if ( $handle = opendir($path) ) { $files = array(); while ( ($file = readdir($handle)) !== false ) { $files[] = $file; } sort($files); foreach ( $files as $file ) { // Do stuff here } } if u use image names with numbers it would be better to set if ( $handle = opendir($path) ) { $files = array(); while ( ($file = readdir($handle)) !== false ) { $files[] = $file; } NATCASESORT($files); //This is what i've changed foreach ( $files as $file ) { // Do stuff here } } Cuz like this it will list for ex. 1img.jpg, 2img.jpg, 11img.jpg otherwise it would to 1img.jpg, 11img.jpg, 2img.jpg. If u dont understand any line in code feel free to ask me
  8. My gallery is making thumbs fine and listing them aswell. The pagination works fine but i cannot handle with these errors whose show under the thumbs in webiste. Seems like the code in else if statement is missing arguments :S, Let's take a look ! Warning: Missing argument 1 for makeThumb(), called in D:\xampp\htdocs\website\galerija\index.php on line 167 and defined in D:\xampp\htdocs\website\galerija\index.php on line 136 Warning: Missing argument 2 for makeThumb(), called in D:\xampp\htdocs\website\galerija\index.php on line 167 and defined in D:\xampp\htdocs\website\galerija\index.php on line 136 Warning: imagesx() expects parameter 1 to be resource, null given in D:\xampp\htdocs\website\galerija\index.php on line 145 Warning: imagesy() expects parameter 1 to be resource, null given in D:\xampp\htdocs\website\galerija\index.php on line 145 Warning: Division by zero in D:\xampp\htdocs\website\galerija\index.php on line 150 Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in D:\xampp\htdocs\website\galerija\index.php on line 152 Warning: imagecopyresampled() expects parameter 1 to be resource, boolean given in D:\xampp\htdocs\website\galerija\index.php on line 153 Warning: imagedestroy() expects parameter 1 to be resource, boolean given in D:\xampp\htdocs\website\galerija\index.php on line 161 Warning: imagedestroy() expects parameter 1 to be resource, null given in D:\xampp\htdocs\website\galerija\index.php on line 162 That's the "problem" code which appears under pictures function getPictures() { global $page, $per_page, $has_previous, $has_next; if ( $handle = opendir(".") ) { $lightbox = rand(); echo '<ul id="pictures">'; $count = 0; $skip = $page * $per_page; if ( $skip != 0 ) $has_previous = true; while ( $count < $skip && ($file = readdir($handle)) !== false ) { if ( !is_dir($file) && ($type = getPictureType($file)) != '' ) $count++; } $count = 0; while ( $count < $per_page && ($file = readdir($handle)) !== false ) { if ( !is_dir($file) && ($type = getPictureType($file)) != '' ) { if ( ! is_dir('thumbs') ) { mkdir('thumbs'); } if ( ! file_exists('thumbs/'.$file) ) { makeThumb( $file, $type ); } echo '<li><a href="'.$file.'" rel="lightbox['.$lightbox.']">'; echo '<img src="thumbs/'.$file.'" alt="" />'; echo '</a></li>'; $count++; } } echo '</ul>'; while ( ($file = readdir($handle)) !== false ) { if ( !is_dir($file) && ($type = getPictureType($file)) != '' ) { $has_next = true; break; } } } } function getPictureType($file) { $split = explode('.', $file); $ext = $split[count($split) - 1]; if ( preg_match('/jpg|jpeg/i', $ext) ) { return 'jpg'; } else if ( preg_match('/png/i', $ext) ) { return 'png'; } else if ( preg_match('/gif/i', $ext) ) { return 'gif'; } else { return ''; } } function makeThumb($file, $type) { global $max_width, $max_height; if ( $type == 'jpg' ) { $src = imagecreatefromjpeg($file); } else if ( $type == 'png' ) { $src = imagecreatefrompng($file); } else if ( $type == 'gif' ) { $src = imagecreatefromgif($file); } if ( ($oldW = imagesx($src)) < ($oldH = imagesy($src)) ) { $newW = $oldW * ($max_width / $oldH); $newH = $max_height; } else { $newW = $max_width; $newH = $oldH * ($max_height / $oldW); } $new = imagecreatetruecolor($newW, $newH); imagecopyresampled($new, $src, 0, 0, 0, 0, $newW, $newH, $oldW, $oldH); if ( $type == 'jpg' ) { imagejpeg($new, 'thumbs/'.$file); } else if ( $type == 'png' ) { imagepng($new, 'thumbs/'.$file); } else if ( $type == 'gif' ) { imagegif($new, 'thumbs/'.$file); } imagedestroy($new); imagedestroy($src); } And these are my 3 functions i use to do that all i think no more source is needed even those 2 functions aren't needed, the only problem as i see is in makeThumb function
  9. $strana = $_GET['strana']; if(isset($strana){ if ($strana == "2"){ //My code for ?strana=2 } elseif($strana == "3"){ //My code for ?strana=3 } else{ //My code for ?strana } } else{ //My code when strana is not set } how would i define here that index.php is same as index.php?strana?
  10. this was just a part of code, well my xampp sucked. ITs solved nvm ty anyway
  11. Can be those <input ...> types with values changed from a script ?. Imagine it like we have an admin and we want to change some input values with a generated form on that page instead of going source and changing 1 by 1 ?
  12. Here, and gl echo (" <form method = 'get' action = 'member.php?action=Search&option=faction&name=' . $_GET['member'] . '> Faction's Name: <input type='text' name='member' /><br /><br /> <input type='submit' value='Search' /> </form> ");
  13. Actually i insert my css into the heading of my php site, the first one recognizes it the second one doesnt ... zomg. Dreamweaver shows it does but when i fill my form and click on submit it stays the "undefined" look at the code ?> <h1>Vaši rezultati kviza su sljedeći:</h1> <?php function postotak($bodovi_ufun, $ukupno_ufun){ $p = $bodovi_ufun / $ukupno_ufun; $postotak = $p * 100; $postotak = round($postotak) . "%"; return $postotak; } //IF I PUT HERE TEXTBOX echo '<b>Vaš ukupan broj bodova jeste ' . $bodovi . ' to je procentualno ' . postotak($bodovi, $ukupno); //AND FINISH HERE, IT GETTING SHOWED IN DREAMWEAVER BUT NOT IN MY BROWSER WHY ? ?>
  14. Obviously u didnt get what i mean, that variable will give FALSE because i use just for ex. localhost/fuckme/index.php so it would still show my second form ... I want some code that will check for me do i use index.php or index.php?strana=(no matther what number)
  15. ive got something like this if (isset($_GET['strana']) && $_GET['strana'] == ""){ //and here comes the form code 1 ... } //then i got else, form code 2. Since i wanna show only 2 forms i can just use if, else else{ ... }
  16. if i got some homepage named index.php and got a $_GET function which calls index.php?strana=2, how do i define so my index.php or just www.example.com/folder/ is same like index.php?strana. Cuz Ive got 2 forms on my website and when i put index.php?strana - i get the first one, when i put index.php?strana=2 - i get the second one but when i put index.php only or blank as i said above im still getting second form
  17. it is, soz this code wasnt copied from dreamweaver just typed it cuz it would be faster than searching for it
  18. got this now, still same :S <?php if (isset($strana == ""){ ?> <div id="form"> <form action="index.php?strana=2" method="post"> <b>1.Kako zapocinjemo i završavamo polje php koda?</b><br /> <input type="radio" name="p1" value="da" />< ?php ?><br /> <input type="radio" name="p1" value="ne" />< php ?><br /> <input type="radio" name="p1" value="ne" />< ? ><br /><br /> <b>2.Od cega je skracenica php?</b><br /> <input type="radio" name="p2" value="ne" />Personal Hypertext Processor<br /> <input type="radio" name="p2" value="da" />PHP: Hypertext Preprocessor<br /> <input type="radio" name="p2" value="ne" />Power Hypertext Presentation<br /><br /> <b>3.Kako koristimo funkciju define u phpu da definiramo parametar "broj" kao "1"?</b><br /> <input type="radio" name="p3" value="da" />define ("broj", "1");<br /> <input type="radio" name="p3" value="ne" />echo ("broj", "1");<br /> <input type="radio" name="p3" value="ne" />Write.def ("broj" + "1");<br /><br /> <b>4.Kako zapocinjemo komentare?</b><br /> <input type="radio" name="p4" value="da" />//<br /> <input type="radio" name="p4" value="ne" />**<br /> <input type="radio" name="p4" value="ne" /><--<br /><br /> <b>5.Kako biste napisali "Zdravo!" ?</b><br /> <input type="radio" name="p5" value="ne" />("Zdravo!")<br /> <input type="radio" name="p5" value="da" />echo "Zdravo!";<br /> <input type="radio" name="p5" value="ne" />Document.Write("Zdravo!");<br /><br /> <b>6.Sa kojim znakom definiramo varijable?</b><br /> <input type="radio" name="p6" value="ne" />&<br /> <input type="radio" name="p6" value="ne" />#<br /> <input type="radio" name="p6" value="da" />$<br /><br /> <b>7.Sa kojim znakom završavamo iskaz?</b><br /> <input type="radio" name="p7" value="ne" />:<br /> <input type="radio" name="p7" value="da" />;<br /> <input type="radio" name="p7" value="ne" />< /php><br /><br /> <input type="submit" value="Dalje" /> </form> </div> <?php } else { ?> <div id="form"> <form action="rezultati.php" method="post"> <b>1.Kako zapocinjemo i završavamo polje php koda?</b><br /> <input type="radio" name="p1" value="da" />< ?php ?><br /> <input type="radio" name="p1" value="ne" />< php ?><br /> <input type="radio" name="p1" value="ne" />< ? ><br /><br /> <b>2.Od cega je skracenica php?</b><br /> <input type="radio" name="p2" value="ne" />Personal Hypertext Processor<br /> <input type="radio" name="p2" value="da" />PHP: Hypertext Preprocessor<br /> <input type="radio" name="p2" value="ne" />Power Hypertext Presentation<br /><br /> <b>3.Kako koristimo funkciju define u phpu da definiramo parametar "broj" kao "1"?</b><br /> <input type="radio" name="p3" value="da" />define ("broj", "1");<br /> <input type="radio" name="p3" value="ne" />echo ("broj", "1");<br /> <input type="radio" name="p3" value="ne" />Write.def ("broj" + "1");<br /><br /> <b>4.Kako zapocinjemo komentare?</b><br /> <input type="radio" name="p4" value="da" />//<br /> <input type="radio" name="p4" value="ne" />**<br /> <input type="radio" name="p4" value="ne" /><--<br /><br /> <b>5.Kako biste napisali "Zdravo!" ?</b><br /> <input type="radio" name="p5" value="ne" />("Zdravo!")<br /> <input type="radio" name="p5" value="da" />echo "Zdravo!";<br /> <input type="radio" name="p5" value="ne" />Document.Write("Zdravo!");<br /><br /> <input type="submit" value="Završi" /> </form> <?php } ?> also tried and same if (isset($_GET['strana'] == ""){
  19. Im making a quiz and what i want to add some dinamic to my "quiz website", for example ill list 10 items on one page and 10 on the other page. So i added this code, but it displays me both forms ... How do i set it if the get variable is in my example "index.php?strana=2" to display only second form or give a shot of ur code how would u do it cuz im a begginer ?php $strana = $_GET['strana']; if($strana = "") $strana = 1; ?> <h1>Provjerimo koliko znaš o php-u </h1> <div id="form"> <form action="index.php?strana=2" method="post"> <b>1.Kako zapocinjemo i završavamo polje php koda?</b><br /> <input type="radio" name="p1" value="da" />< ?php ?><br /> <input type="radio" name="p1" value="ne" />< php ?><br /> <input type="radio" name="p1" value="ne" />< ? ><br /><br /> <b>2.Od cega je skracenica php?</b><br /> <input type="radio" name="p2" value="ne" />Personal Hypertext Processor<br /> <input type="radio" name="p2" value="da" />PHP: Hypertext Preprocessor<br /> <input type="radio" name="p2" value="ne" />Power Hypertext Presentation<br /><br /> <b>3.Kako koristimo funkciju define u phpu da definiramo parametar "broj" kao "1"?</b><br /> <input type="radio" name="p3" value="da" />define ("broj", "1");<br /> <input type="radio" name="p3" value="ne" />echo ("broj", "1");<br /> <input type="radio" name="p3" value="ne" />Write.def ("broj" + "1");<br /><br /> <b>4.Kako zapocinjemo komentare?</b><br /> <input type="radio" name="p4" value="da" />//<br /> <input type="radio" name="p4" value="ne" />**<br /> <input type="radio" name="p4" value="ne" /><--<br /><br /> <b>5.Kako biste napisali "Zdravo!" ?</b><br /> <input type="radio" name="p5" value="ne" />("Zdravo!")<br /> <input type="radio" name="p5" value="da" />echo "Zdravo!";<br /> <input type="radio" name="p5" value="ne" />Document.Write("Zdravo!");<br /><br /> <b>6.Sa kojim znakom definiramo varijable?</b><br /> <input type="radio" name="p6" value="ne" />&<br /> <input type="radio" name="p6" value="ne" />#<br /> <input type="radio" name="p6" value="da" />$<br /><br /> <b>7.Sa kojim znakom završavamo iskaz?</b><br /> <input type="radio" name="p7" value="ne" />:<br /> <input type="radio" name="p7" value="da" />;<br /> <input type="radio" name="p7" value="ne" />< /php><br /><br /> <input type="submit" value="Dalje" /> </form> </div> <?php if($_GET['strana'] == 2){ ?> <div id="form"> <form action="rezultati.php" method="post"> <b>1.Kako zapocinjemo i završavamo polje php koda?</b><br /> <input type="radio" name="p1" value="da" />< ?php ?><br /> <input type="radio" name="p1" value="ne" />< php ?><br /> <input type="radio" name="p1" value="ne" />< ? ><br /><br /> <b>2.Od cega je skracenica php?</b><br /> <input type="radio" name="p2" value="ne" />Personal Hypertext Processor<br /> <input type="radio" name="p2" value="da" />PHP: Hypertext Preprocessor<br /> <input type="radio" name="p2" value="ne" />Power Hypertext Presentation<br /><br /> <b>3.Kako koristimo funkciju define u phpu da definiramo parametar "broj" kao "1"?</b><br /> <input type="radio" name="p3" value="da" />define ("broj", "1");<br /> <input type="radio" name="p3" value="ne" />echo ("broj", "1");<br /> <input type="radio" name="p3" value="ne" />Write.def ("broj" + "1");<br /><br /> <b>4.Kako zapocinjemo komentare?</b><br /> <input type="radio" name="p4" value="da" />//<br /> <input type="radio" name="p4" value="ne" />**<br /> <input type="radio" name="p4" value="ne" /><--<br /><br /> <b>5.Kako biste napisali "Zdravo!" ?</b><br /> <input type="radio" name="p5" value="ne" />("Zdravo!")<br /> <input type="radio" name="p5" value="da" />echo "Zdravo!";<br /> <input type="radio" name="p5" value="ne" />Document.Write("Zdravo!");<br /><br /> <input type="submit" value="Završi" /> </form> <?php } ?> Don't mind on these input radio buttons, especially in second form cuz those first 5 are copied from first form
  20. hmm lol look at this function postotak($bodovi){ $p = $bodovi / 100; $postotak = $p * 100; $postotak = $postotak . "%"; return $postotak; } Warning: Missing argument 1 for postotak(), called in D:\xampp\htdocs\vjezbe\kviz - seica\rezultati.php on line 35 and defined in D:\xampp\htdocs\vjezbe\kviz - seica\rezultati.php on line 28 - THIS IS THE ERROR I GOT BY PASSING THE VARIABLE TO THE FUNCTION 28th line is the first line of this function
  21. yeah thanks for that $postotak = $postotak . "%"; figured it now. The variable isnt defined but i used global $bodovi outside of function, shouldnt be same ?
  22. the round function goes on an integer as i read 5 minutes ago, but if there is no other way it not a big deal rly ... (for ex. if $score = 60, $p=$score/110, $postotak=$p*100, $postotak = 54%). Btw my function postotak(){ $p = $bodovi / 100; $postotak = $p * 100; $postotak = $postotak + "%"; return $postotak; } It does return nothing why
  23. Ive got a simple function that's counting percentages of the results, and what I want is when the first line does $variable / 100 - to go on 2 decimals(ex. 0.72142141 what I want is to write 0.72). function postotak(){ $p = $bodovi / 100; $postotak = $p * 100;
×
×
  • 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.