Jump to content

Barny74

Members
  • Posts

    75
  • Joined

  • Last visited

Barny74's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

2

Community Answers

  1. I have coded a contact form , but for some reason I am not actually getting the email , but the php code has no errors and the form returns a success message. I have removed my email address from the code here. Appreciate any help. Contact form <body> <div class='formbody'> <link href='http://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='text/css'> <form id="contact-form" action="send.php" method="POST"> <p>Hi</p> <p>My <label for="your-name">name</label> is <input type="text" name="your-name" id="your-name" minlength="3" placeholder="(your name here)" required> and</p> <p>my <label for="email">email address</label> is <input type="email" name="your-email" id="email" placeholder="(your email address)" required> </p> <p> I have a <label for="your-message">message</label> for you,</p> <p> <textarea name="your-message" id="your-message" placeholder="(your msg here)" class="expanding" required></textarea> </p> <p> <button type="submit"> <svg version="1.1" class="send-icn" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="100px" height="36px" viewBox="0 0 100 36" enable-background="new 0 0 100 36" xml:space="preserve"> <path d="M100,0L100,0 M23.8,7.1L100,0L40.9,36l-4.7-7.5L22,34.8l-4-11L0,30.5L16.4,8.7l5.4,15L23,7L23.8,7.1z M16.8,20.4l-1.5-4.3 l-5.1,6.7L16.8,20.4z M34.4,25.4l-8.1-13.1L25,29.6L34.4,25.4z M35.2,13.2l8.1,13.1L70,9.9L35.2,13.2z" /> </svg> <small>SEND PLEASE</small> </button> </p> </form> <script src="assets/js/jquery.min.js"></script> <script src="assets/bootstrap/js/bootstrap.min.js"></script> <script src="assets/js/bs-animation.js"></script> <script src="assets/js/index.js"></script> </div> </body> </html> Send.php <?php $page='contactus'; include('header.php'); include('navbar.php'); ?> <?php $to = 'removed'; $name = TRIM (stripslashes($_POST['your-name'])); $email = TRIM (stripslashes($_POST['your-email'])); $message = TRIM (stripslashes($_POST['your-message'])); $subject = 'Message'; $name = 'Name: '; $email= 'From:'; $message= 'Message: '; if( mail($to, $subject, $name , $email , $message) ){ echo 'success'; } else{ print('There has been a small error . Sorry!!'); } ?>
  2. I got my answer thanks. My script.php was not loading. Works fine now.
  3. Hi. If the img that the code is currently pointing to via the db is taken down , i would like to have a second image as backup. And that second image is on my seever. Thanks
  4. I have tried the below but image does not load. echo "<img src='".$row ['url_img']."' onerror='this.onerror=null';this.src='no_img.jpg' /><br />";
  5. Sorry , just updated the code as I pasted the wrong code in
  6. Hi, I have been trying to code some javascript to detect when an image does not load , but having no luck as new to javascript. I am trying to replace the below , if it does not load, echo "<img src='".$row ['url_img']."' /><br />"; with an image called no_img.jpg if (isset($_GET['id'])) { $sql = "SELECT w.whisky_name , price , date , avprice ,url_img ,whisky_id FROM test_db t JOIN whisky w USING (whisky_id) JOIN ( SELECT whisky_id , AVG(price) as avprice FROM test_db WHERE whisky_id = :id GROUP BY whisky_id ) avcalc USING (whisky_id) ORDER BY date DESC LIMIT 1"; $stmt = $conn->prepare($sql); $stmt->execute( array( 'id' => $_GET['id']) ); $row = $stmt->fetch(); echo "<div class='details'>"; echo "<br>"; echo $row['whisky_name']; echo "<br><br>"; echo "Average price based on all sales" ; echo"<br><br>"; echo "<div class= 'price'>"; echo " £"; echo floor ($row ['avprice']); echo "</div>"; echo "<br>"; echo "<div class='img_border'>"; echo "<img src='".$row ['url_img']."' /><br />"; echo "<a href='records.php?id={$row['whisky_id']}' >Click here for more detailed results</a>"; echo "<br>"; echo "</div>"; } ?> Appreciate the help
  7. Barny74

    HTML Alt img

    Fair comment. Will look at some javascript. Thanks
  8. Barny74

    HTML Alt img

    Hi. I woudl like to have an alt image instead of alt text. I am trying the below for thee text , but cant figure out how to have an alt img , the alt image is called no_img.jpg echo "<img src='".$row ['url_img']."' alt='Sorry no image available'/><br>"; Thanks
  9. Quick question. I just uploaded the website to a online test site , I have added the database and connected etc and the search works fine , but when I click on one of the results I get the following error Parse error: syntax error, unexpected '[', expecting ')' in details1.php on line 40 workds perfectly offline and I am connecting ok because I can do an initial search. I am in a holding pattern with support... yawn <?php $page='details'; include('header.php'); include ('navbar.php'); include ('connect.php'); if (isset($_GET['id'])) { $sql = "SELECT w.whisky_name , price , date , avprice ,url_img ,whisky_id FROM test_db t JOIN whisky w USING (whisky_id) JOIN ( SELECT whisky_id , AVG(price) as avprice FROM test_db WHERE whisky_id = :id GROUP BY whisky_id ) avcalc USING (whisky_id) ORDER BY date DESC LIMIT 1"; $stmt = $conn->prepare($sql); $stmt->execute( [ 'id' => $_GET['id'] ] ); $row = $stmt->fetch(); echo "<div class='details'>"; echo "<br>"; echo $row['whisky_name']; echo "<br><br>"; echo "Average price based on all sales" ; echo"<br><br>"; echo "<div class= 'price'>"; echo " £"; echo floor ($row ['avprice']); echo "</div>"; echo "<br>"; echo "<div class='img_border'>"; echo "<img src='".$row ['url_img']."' /><br />"; echo "</div>"; echo "<br>"; echo "<a href='records.php?id={$row['whisky_id']}' >Click here for more detailed results</a>"; echo "<br>"; echo "</div>"; } ?> line 39 $stmt = $conn->prepare($sql); line 40 $stmt->execute( [ 'id' => $_GET['id] ] );
  10. 2. About 5k per download 3. Not very often for new whiskies , but it is possible.
  11. Thanks for the reaponse. 1. I currently download all the info into excel format and then save as a csv. It basically has the following headings. Name , date of last sale , sale price of last sale , auction link , image link , lot number. I usually download it then copy the info into a CSV that has all records in it.
  12. Thanks , i just get a bit confused if i am running sql query or pho code. Thanks and will give it a go
×
×
  • 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.