Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7083599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:11:53+00:00 2026-05-28T07:11:53+00:00

I´ve got the a php that returns a JSON string: $recipes = json_encode($arr); That

  • 0

I´ve got the a php that returns a JSON string:

$recipes = json_encode($arr);

That is my php-code how I output the recipe-title:

<?php
 include('php/getAllRecipes.php');
 $jsonstring = $recipes;
 $recip = json_decode($recipes, true);
 $i = 1;
 var data = include('php/getAllRecipes.php')Data.Recipes;
foreach ($recip['Data']['Recipes'] as $key => $recipe) {
        echo "$i.) &nbsp ";
        echo  $recipe['TITLE'];
        $i = $i + 1;
        echo "<br>";
 } 
 ?>

Now, I need to add a href to each title. The href should contain a link to recipe_search.php and I have to give it the id of each recipe.
How can I add this href?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:11:54+00:00Added an answer on May 28, 2026 at 7:11 am
    <?php
     include('php/getAllRecipes.php');
     $jsonstring = $recipes;
     $recip = json_decode($recipes, true);
    ?>
    <ol>
    <?php
    foreach ($recip['Data']['Recipes'] as $key => $recipe) {
            echo '<li>
                      <a href="/recipe_search.php?id=' . $recipe['ID'] . '">
                          ' . $recipe['TITLE'] . '
                      </a>
                  </li>';
     } 
     ?>
    </ol>
    
    1. Use an ordered list (<ol>) instead of trying to create one yourself using a counter.
    2. var data = include('php/getAllRecipes.php')Data.Recipes; is not valid PHP.
    3. I assume that the id of the recipe is in $recipe['ID'].
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got some code that was at the bottom of a php file that
I've got a section of code on a b2evo PHP site that does the
I got some legacy code that has this: <?PHP if(isset($_GET['pagina'])==homepage) { ?> HtmlCode1 <?php
I've got some code that takes any address and returns lat and long as
I have a php page that returns json like this: while ($row = oci_fetch_array($stid,
Jquery puzzle I've got a php script that returns the name of random jpg
I've got a simple bit of code in PHP that queries, grabs the resulting
I've got a jQuery function that retrieves a JSON response from a PHP page.
I've got a PHP script that needs to invoke a shell script but doesn't
I've got a PHP page that parses an XML file with SimpleXml, then passes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.