4 Replies - 192 Views - Last Post: 17 March 2014 - 01:56 PM Rate Topic: -----

#1 AndKo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 17-March 14

I am trying to make my list clickable but it doesnt work

Posted 17 March 2014 - 01:02 PM

I'm trying to make this lis clickable and every time you click to one of the items of the list to go to the file.
Can you suggest me a better idea? Thank you

 <?php

if ($_POST['submit']) {
   $date = $_POST['data'];
   $text = $_POST['textdata'];
   $getDate = $_GET['data'];

   file_put_contents("$date.txt", $text);
   $datesArray = array();
   array_push($datesArray, glob("*.txt"));
   foreach (glob("*.txt") as  $value) {
      echo '<ul>';
      echo '<li>' . '<a href="$getDate" >' . $value . '</a>' . '</li>';
      echo '</ul>';
   }
 }



Is This A Good Question/Topic? 0
  • +

Replies To: I am trying to make my list clickable but it doesnt work

#2 astonecipher  Icon User is offline

  • Major DIC Head
  • member icon

Reputation: 564
  • View blog
  • Posts: 2,536
  • Joined: 03-December 12

Re: I am trying to make my list clickable but it doesnt work

Posted 17 March 2014 - 01:39 PM

What value is expected in $getDate? What does it link to?
Was This Post Helpful? 0
  • +
  • -

#3 AndKo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 8
  • Joined: 17-March 14

Re: I am trying to make my list clickable but it doesnt work

Posted 17 March 2014 - 01:50 PM

because im new in php im trying to make a diary.....im saving eache text into a file with the date u entered name.Im trying to make a list of those text so you can open any date you like.
Was This Post Helpful? 0
  • +
  • -

#4 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6039
  • View blog
  • Posts: 23,436
  • Joined: 23-August 08

Re: I am trying to make my list clickable but it doesnt work

Posted 17 March 2014 - 01:53 PM

Variables are not replaced inside of single quotes like this:

echo '<li>' . '<a href="$getDate" >' . $value . '</a>' . '</li>';


Instead, you can try this:

echo '<li>' . '<a href="' . $getDate . '" >' . $value . '</a>' . '</li>';

Was This Post Helpful? 1
  • +
  • -

#5 astonecipher  Icon User is offline

  • Major DIC Head
  • member icon

Reputation: 564
  • View blog
  • Posts: 2,536
  • Joined: 03-December 12

Re: I am trying to make my list clickable but it doesnt work

Posted 17 March 2014 - 01:56 PM

So you want the information stored in a database. There are many tutorials on the subject and most php books focus on that type of project.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1