Jump to content

wesley

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by wesley

  1. Hello, I select data from a database in a while loop. But I want to style the data with CSS. my question is: How can I make this like the uploaded image example? my code is: echo "<div>"; while ($record = mysqli_fetch_assoc($result)) { $id = $record ['foto_id']; $titel = $record['titel']; $img = $record['img_thumb']; echo "<h3>$titel</h3>"; echo "<h4>Beoordelingen</h4>"; echo "$id"; echo "<img src='$img' alt='image'> "; echo "<div>"; echo "Beoordeling: <input type='text' name='beoordeling' maxlength='4' size='4'/> (Ja/Nee of ?) <br />"; echo "Commentaar: <textarea rows='4' cols='25'></textarea>"; echo "Commentaar: <textarea rows='4' cols='25'></textarea>"; echo "Commentaar: <textarea rows='4' cols='25'></textarea>"; echo "Commentaar: <textarea rows='4' cols='25'></textarea>"; } echo "</div>"; echo "</div>"; thanks in advance
  2. Hello, I have make a list. I want to show the content of the list. But this is not working. I do this with a for loop. Now I only see @ and numbers. can someone help me? thanks in advance my code is: public static void main(String[] args) { // TODO code application logic here ArrayList<list>items = new ArrayList<>(); items.add(new Draw("oval", 10, 15)); items.add(new Draw("polygon", 30, 28)); // let us print all the elements available in list // this is not working for (list number : items) { System.out.println(number); } }
  3. Hello, I have java code. The code add and remove data from the arraylist. My question is: how can I show the deleted item from the arraylist in system.out.println? thanks in advance. my code is: public static void main(String[] args) { // TODO code application logic here ArrayList<String>items = new ArrayList<>(); items.add("oval"); items.add("polygon"); items.add("spline"); items.add("PaintedText"); items.add("image"); System.out.println("Size of list: " + items.size()); // let us print all the elements available in list for (String number : items) { System.out.println(number); } // Removes element at 3rd position items.remove(2); System.out.println( items.size()); // let us print all the elements available in list for (String number : items) { System.out.println(number); } }
  4. Hey, I'm working with C # and with an if / else statement. But this does not work. With the count you count function the amount of rows in the listbox. The idea is if there are five or fewer rows that one oval (graphic) will be placed and if six or more rows than will show up a different graphic. This does not work because the oval there always will be placed and the other graphic is never executed. My question is: how can I get if / else working? thank you in advance. my code is: private void pnlStatus_Paint(object sender, PaintEventArgs e) { int aantal = haven.Schepen.Count; int number = 5; if (aantal <= number) { Graphics g = e.Graphics; int breedte = 50; int hoogte = 50; g.FillEllipse(Brushes.Green, 10, 10, breedte, hoogte); } else { Graphics gr = e.Graphics; using (Pen p = new Pen(Color.Red, 5)) { gr.DrawLine(p, 0, 0, 50, 50); gr.DrawLine(p, 0, 50, 50, 0); } } } //In the class haven is this the list public List<Schip> Schepen { get { return schepen; } }
  5. Hello, I have a whitelist of pages, but it doesn't work. If you visit a page (write.php) that is not on the white list, the browser isn't going to index.php. But this is not the intention. I have five pages: products.php, contact.php, information.php, login.php and write.php My whitelist is: <?php session_start(); $whitelist = array("/folder/products.php", "/folder/contact.php", "/folder/information.php", "/folder/login.php"); $ip = $_SERVER['SCRIPT_NAME']; //var_dump($ip); if (in_array($ip, $whitelist)) { //echo "You can access the whitelist page!"; } else { session_destroy (); header("Location: index.php");die(); } ?> My question is: how can I make the whitelist when you visit a page, that is not on the whitelist, that the browser go to index.php? can someone help me? thanks in advance.
  6. Hello, I want to show data from three tables with a join, but it doesn't work. I have three tables: linktable, friends and carbrands. The columns are friendnumer, lastname and carbrands. The table linktable must show: column friendnumber. The table friends must show: column lastname and table carbrands must show column brand. my sql is: SELECT friendnumber,lastname, brand From linktable,friends,carbrands WHERE linktable.friendnumber = friends.lastname and friends.lastname = carbrands.brand ; what is going wrong? can someone help me? thanks in advance.
  7. Hello, I have written php and a database in mysql. The meaning is that you see a table to edit/update the data of the form. But how can I make this? I have a attach file, that is a example. My code is: <!DOCTYPE HTML> <html lang="en"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link href="style.css" type="text/css" rel="stylesheet"> </head> <body> <div id="main_container"> <header></header> <div id="box2"></div> <div id="content"> <h1>Vriendenboek</h1> <?php // 1. make connection: require_once ("connect.php"); // 2. Query $query = "SELECT * FROM vrienden ORDER BY achternaam"; // 3. Query make $result = mysqli_query($link, $query) or die(mysqli_error()); // 4. Result echo "<table border='1'>"; echo "<tr>"; echo "<th>vriendnummer</th>"; echo "<th>voornaam</th>"; echo "<th>achternaam</th>"; echo "<th>adres</th>"; echo "<th>woonplaats</th>"; echo "<th>mobiel</th>"; echo "<th>beschrijving</th>"; echo "</tr>"; while ($record = mysqli_fetch_assoc($result)) { $id = $record['id']; $voornaam = $record['voornaam']; $achternaam = $record['achternaam']; $adres = $record['adres']; $woonplaats = $record['woonplaats']; $mobiel = $record['mobiel']; $beschrijving = $record['beschrijving']; echo "<tr>"; echo "<td> $id </td> <td>$voornaam</td> <td>$achternaam</td> <td>$adres</td> <td>$woonplaats</td> <td>$mobiel</td> <td>$beschrijving</td><td><INPUT TYPE='Submit' VALUE='Update the Record' NAME='Submit'></td>"; echo "</tr>"; } echo "</table>"; if(isset($_POST['Submit'])){//if the submit button is clicked $id = $_POST['id']; $voor_naam = $_POST['voornaam']; $achter_naam = $_POST['achternaam']; $adres = $_POST['adres']; $woonplaats = $_POST['woonplaats']; $mobiel = $_POST['mobiel']; $beschrijving = $_POST['beschrijving']; $query=""UPDATE vrienden SET voornaam = '$voor_naam', achternaam = '$achter_naam', adres = '$adres', woonplaats = '$woonplaats', mobiel = '$mobiel', beschrijving = '$beschrijving' WHERE id = '$id'"; mysql_query($query) or die("Cannot update");//update or error } //close connection mysqli_close($link); ?> </body> </html> And I have make this, this works: but without table: where can I make the table? <form method="POST"> <input type="text" name="id" placeholder="vriendnummer"> <br /><br /> <input type="text" name="voornaam" placeholder="voornaam"> <br /><br /> <input type="text" name="achternaam" placeholder="achternaam"> <br /><br /> <input type="text" name="adres" placeholder="adres + nummer"> <br /><br /> <input type="text" name="woonplaats" placeholder="woonplaats"> <br /><br /> <input type="text" name="mobiel" placeholder="mobiel"> <br /><br /> <textarea rows="4" cols="50" placeholder="beschrijving" name="beschrijving"></textarea> <br /><br /> <input type="submit" name="update" value="update"> </form> <?php //make connection require_once ("connect.php"); $id = $_POST['id']; $voor_naam = $_POST['voornaam']; $achter_naam = $_POST['achternaam']; $adres = $_POST['adres']; $woonplaats = $_POST['woonplaats']; $mobiel = $_POST['mobiel']; $beschrijving = $_POST['beschrijving']; $sql = "UPDATE vrienden SET voornaam = '$voor_naam', achternaam = '$achter_naam', adres = '$adres', woonplaats = '$woonplaats', mobiel = '$mobiel', beschrijving = '$beschrijving' WHERE id = '$id'"; if (mysqli_query($link, $sql)) { echo "Data met succes gewijzigd"; } else { echo "Error: " . $sql . "<br>" . mysqli_error($link); } mysqli_close($link); ?> my question is: how can i make a edit table (like attch file) in php with the code above? thanks in advance.
  8. Hello, I have written a php script but I see nothing in the browser. I want to show words and images form a mysql database. But there is something wrong with the image img tag. Can someone help me? thanks in advance the code is: echo "<ul>"; while ($record = mysqli_fetch_assoc($result)) { $id = $record['id']; $brand = $record['brand']; $description = $record['description']; $images = $record['images']; $title = $record['title']; echo "<li> $id $brand $description </li>"; echo "<img src="car/.$images." height="100" title="$title" alt="car" />";//this is going wrong } echo "</ul>";
  9. Hello, I have two things. I have phpmailer, he sent the content of the form to a E-mailaddress, this works. And I have phpword, he make word file, this also works. I have a question; how can I get the content of the form the $message (Full name, subject, phone, email and comments) in a word file in a Email attachment if you click on the submit button? With this code you see nothing in the browser. Can someone help me? thanks in advance. The form code is: <?php //phpword require_once '../PHPWord.php'; // New Word Document $PHPWord = new PHPWord(); // New portrait section $section = $PHPWord->createSection(); $section->addText($message, array('name'=>'Verdana', 'color'=>'006699')); $section->addTextBreak(2); // Save File $objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007'); $objWriter->save('Text.docx'); //phpmailer if(isset($_POST['submit'])) { $message= 'Full Name: '.$_POST['fullname'].'<br /> Subject: '.$_POST['subject'].'<br /> Phone: '.$_POST['phone'].'<br /> Email: '.$_POST['emailid'].'<br /> Comments: '.$_POST['comments'].' '; require "phpmailer/class.phpmailer.php"; //include phpmailer class // Instantiate Class $mail = new PHPMailer(); // Set up SMTP $mail->IsSMTP(); // Sets up a SMTP connection $mail->SMTPAuth = true; // Connection with the SMTP does require authorization $mail->SMTPSecure = "ssl"; // Connect using a TLS connection $mail->Host = "smtp.gmail.com"; //Gmail SMTP server address $mail->Port = 465; //Gmail SMTP port $mail->Encoding = '7bit'; // Authentication $mail->Username = "test@gmail.com"; // Your full Gmail address $mail->Password = "secret"; // Your Gmail password // Compose $mail->SetFrom($_POST['emailid'], $_POST['fullname']); $mail->AddReplyTo($_POST['emailid'], $_POST['fullname']); $mail->Subject = "form from website"; // Subject (which isn't required) $mail->MsgHTML($message); // Send To $mail->AddAddress("test@gmail.com", "form from website"); // Where to send it - Recipient $result = $mail->Send(); // Send! $message = $result ? 'Successfully Sent!' : 'Sending Failed!'; unset($mail); } ?> <!DOCTYPE HTML> <html lang="en"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <div style="margin: 100px auto 0;width: 300px;"> <h3>Contact Form</h3> <form name="form1" id="form1" action="" method="post"> <fieldset> <input type="text" name="fullname" placeholder="Full Name" required/> <br /> <input type="text" name="subject" placeholder="Subject" /> <br /> <input type="text" name="phone" placeholder="Phone" /> <br /> <input type="text" name="emailid" placeholder="Email" required/> <br /> <textarea rows="4" cols="20" name="comments" placeholder="Question/Comments"></textarea> <br /> <input type="submit" name="submit" value="Send" /> </fieldset> </form> <p><?php if(!empty($message)) echo $message; ?></p> </div> </body> </html>
  10. Hello, I have a question. I have make a form with three textareas with <textarea>. People types words or stories in the textares. If you click on a submit button of the form then the stories send to a E-mailaddress in a attachment in Word. But how can I make this? So how can I make a word attachment from the textareas of a form? can someone give me advice? thanks in advance.
  11. Hello, I have make a php oop script. The meaning is that when you submit the form that it count. my question is: I must somethig add, but what that the form count? can someone help me? thanks in advance. my code is: class:<?phpclass Teller{ public $counter=1; public function ophogen() { $this->counter++; }}?>index.php:<?phpsession_start();require_once ("class.php");if(!isset($_SESSION['counter'])) { $_SESSION['counter'] = 0; }if(isset($_POST['button'])) { ++$_SESSION['counter']; } ?><!DOCTYPE HTML><html lang="en"><head> <title></title> </head><body><form method="POST"> <input type="hidden" name="counter" value="<?php echo $_SESSION['counter']; ?>" /> <input type="submit" name="button" value="count" /> <br/><?php echo $_SESSION['counter']; ?></form></body></html>
  12. Hello, I have make a screenshot how it should be. maybe is this better. How can I make this? the code show the thumbnails and now the "big photo" under the thumbnails.
  13. Hello, I have written php script. You see three thumbnails. When you click on the thumbnail the browser open a new screen with the big photo. and i work without database. I want to have that the big photo under the thumbnail is, and not a new window or pop-up. my question is: how can i make this? thanks in advance. my code is: <!DOCTYPE HTML><html lang="en"><head> <title></title> <style> img{ border: 1px dotted red; } </style></head><body><?php$dir = "images/";//open directoryif ($opendir = opendir($dir)){ //read directory while (($file = readdir($opendir)) !== FALSE) { if($file !="."&&$file!="..") echo "<a href='$dir/$file'><img src='$dir/$file' height='100'></a>";//show thumbnail }}?></body></html>
  14. Thank you, But I have add $galleryHTML =""; on the top (see code), you mean this?, and the images (all jpg) are in the img folder and it doesn't work. the images are not to see in the browser. Can you help me? <?phpfunction showGallery(){ $galleryHTML =""; $galleryHTML .= "<ul>"; $images = new DirectoryIterator("img"); while($images->valid() ){ $file = $images->current(); $filename = $file->getFilename(); $src = "img/$filename"; $info = new Finfo( FILEINFO_MIME_TYPE ); $type = $info->file($src); if($type === "image/jpg"){ $galleryHTML .= "<li><img src='$src' alt='image gallery' /></li>"; } $images->next(); } $galleryHTML .= "</ul>"; return $galleryHTML;}echo showGallery();?>
  15. Hello. I have a php script and this show the images from a folder img in the browser. But the images doesn't show in the browser. Can someone help me with the code? My question is: what is wrong on the script? How can I show the images in the browser? thanks in advance. my code is: <?phpfunction showGallery(){ $galleryHTML .= "<ul>"; $images = new DirectoryIterator("img"); while($images -> valid() ){ $file = $images->current(); $filename = $file->getFilename(); $src = "img/$filename"; $info = new Finfo( FILEINFO_MIME_TYPE ); $type = $info->file($src); if($type === "image/jpeg"){ $galleryHTML .= "<li><img src='$src' alt='image gallery' /></li>"; } $images->next(); } $galleryHTML .= "</ul>"; return $galleryHTML;}echo showGallery();?>
  16. Hello,I have made code. The meaning is if you click on the color in the <option> then the background color change.But this doesn't work.Can someone help me?thanks in advance. <?php$red = "";$yellow = "";$blue = "";$orange = "";$purple = "";if (isset($_POST['color'])) {$color = $_POST['color'];}else {$color = '';}?><html><head><title>color changer</title><style>option.red { background-color: red; }option.yellow { background-color: yellow; }option.blue { background-color: blue; }option.orange { background-color: #FF8040; }option.purple { background-color: #800080; }</style></head><body bgcolor="<?php echo color; ?>"><form action="" method="POST"><select name="background"> <option style="display:none;" selected="selected">color</option> <option class="red" value="red" <?php echo $red; ?>>Red</option> <option class="yellow" value="yellow" <?php echo $yellow; ?>>Yellow</option> <option class="blue" value="blue" <?php echo $blue; ?>>Blue</option> <option class="orange" value="orange" <?php echo $orange; ?>>Orange</option> <option class="purple" value="purple" <?php echo $purple; ?>>Purple</option> </select><input type="submit" name="submit" value="change"></form></body></html>
  17. Hello,I have make a function. You see random three letters; a, b and c when refresh the page.But I want to have a if else statement when one of the three letters are equel (for example A A A.)then a echo: you win.I have write a function and a if else statement but it doesn't work.My question is: What is the right if else statement for to get the echo 'you win' when one letter (A A A) are on the screen?thanks in advance.my code is: function jackpot(){$a=array("A","B","C");shuffle($a);echo "$a[0] $a[1] $a[2]";if($a == "A" && $a == "A" && $a == "A" ){ echo "you win"; }}jackpot();
  18. Hello,I have make a random string with a array. The letters A, B and C are in a array.The letters must be see random in the browser, all three next to each other. But this doesn't work. Now the letters ABC are static in the browser and not random if you refresh the page.Can someone help me? How can I get the letters random?thanks in advcance.my code is: <?php$a=array("A","B","C");$random_keys=array_rand($a, 3);echo $a[$random_keys[0]];echo $a[$random_keys[1]];echo $a[$random_keys[2]];
  19. Hello, I have written a function in php. If you refresh the page you see a another image, but this doesn't work. Now I see the 4 images in the browser. Can someone help me what is wrong, why didn't work mt_rand? thanks in advance. function photorandom() { $photo = array("www.google.nl" => "1.jpg", "www.bing.com" => "2.jpg", "3.jpg", "4.jpg"); $random = mt_rand(0, (count($photo)-1)); $randomImage = $photo[$random]; foreach($photo as $link => $randomImage) { echo "<a href='http://{$link}'><img src=' {$randomImage} ' width='500'></a>"; } }photorandom();
  20. wesley

    random image

    Hello, I have a question. I want to make a random image function with a array. When I refresh the webpage you see a another random image. It is required to use the php function mt_rand();. When I search on the internet I see the mt_rand accept only integers. Can someone give me advice how to fix this? Is it possible to convert int to image? The code is: function photorandom() { $photo = array("1.jpg", "2.jpg", "3.jpeg", "4.jpg"); $random = mt_rand(); echo "<img src="$photo" alt="">";}photorandom(); thanks in advance.
  21. Hello, I have a function that looks at whether there is md5 or sha1 is used. The function would then encrypt the word password. But this he does not. How can I make the variable $method? $methode = md5 (); doesn't work, $method = md5; doesn't work can someone help me? thanks in advance function encrypt($input, $method){ if($method == "md5"){ return md5($input); }else{ return sha1($input) } } $input = "password"; $methode = md5 (); //this doesn't work echo encrypt($input, $method);
  22. Hello, I have three images. When I load the webpage you see the images with random mt_rand(). But I want to have a preference. Let an image 50% of the times, another picture 20% of the times and the other images in 10% of the times. How can I make this? Is here a tutorial about? thanks in advance.
  23. Hello, Can anyone tell me how I create a for loop which incurs a sentence of 10 pixels to 100 pixels? So the word sentence font-size from 10 to 100 px. for ($x = "sentence"; $x "font-size" ; $xxx) { echo "$x <br>";} thanks in advance.
  24. wesley

    align form with css

    Hello, I have make a form. But the form is not align. I want to have spece between the label and the input, like in the image. The dual column example you see space between the label and the input. My question is: how can I make this? My css is: label{ display:block; color: white; margin:12px; padding: 12px; }input{ height:40px; width: 190px; font-size:20px;} thanks in advance.
  25. Hello, I'm working to create a website where you have three images side by side. I would like to justify through three align an image on a div. I have created a class, but on the one page he does this and on other page aligns he doesn't matter. My question is: can anyone advise me how I can fix this that the three be aligned the same images on all pages? Thanks in advance. page 1 here is aligned:<div id="box4"><h2>Gebouwen</h2><p class="right"><img src="images/gebouwen/image1.jpg" width="250" alt="text"><img src="images/gebouwen/image.jpg" width="250" alt="text"><img src="images/gebouwen/image3.jpg" width="250" alt="text"><img src="images/gebouwen/image3.jpg" width="250" alt="text"></p></div>page 2 here is not aligned:<div id="box4"><h2>Musea</h2><p class="right"><img src="images/musea/image4.JPG" width="250" alt="text"><img src="images/musea/image5.jpg" width="250" alt="text"><img src="images/musea/imagr6.jpg" width="250" alt="text"></p></div> My css is:.right{margin: 30px;text-align: justify;}div#box4{width: 1000px;background-color: #660000;float: left;}
×
×
  • Create New...