wesley

Members
  • Content count

    31
  • Joined

  • Last visited

Community Reputation

3 Neutral

About wesley

  • Rank
    Newbie
  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();?>