logo
down
shadow

Using previous page array values in php into another page


Using previous page array values in php into another page

By : Bryant Fu
Date : November 18 2020, 11:13 AM
will help you I have edited your code for product detail page.. As you've not defined $productName variable anywhere in page. I've customized your code and hope it'll be good for you..
code :
include 'productData.php';



       <?php

         if (isset($_GET['cat']) && isset($productArr[$_GET['cat']])) {
            $productNames = $productArr[$_GET['cat']];   //Added $productNames here to asign your current product category
        }

          foreach($productNames as $name=>$details): 
            if (isset($_GET['code']) && $name==$_GET['code']){

            //$name is product name.
            //print_r($details);
            // now you can use $details['images'], $details['dimension'], $details['price'] as you want...
          ?>

            <div class="category">

                <div class="col-md-3">

                    <a class="thumbnail">
                        <img src="<?php echo "img/" . $details['image'] ?>" class="img-rounded" width="250" height="220">
                        <div class="title"><h3><?php echo $name; ?></h3></div>
                    </a>

                </div>

            </div>

        <?php } ?> 
        <?php endforeach; ?> 


Share : facebook icon twitter icon
How to write the code without disturbing page data to get the previous page values?

How to write the code without disturbing page data to get the previous page values?


By : user3348096
Date : March 29 2020, 07:55 AM
it should still fix some issue Just to make sure I'm on the right page: You have a drop down list with items. Picking an item from the list shows data related to that item in a GridView. Picking the second item on the list, "Add New Item", shows a different window which allows you to add a new item. You don't want the process of adding a new item to interupt any activities going on on the GridView page. After adding a new item you want the items listed in the DropDownList to automatically update.
I would suggest using AJAX with a Modal dialog box for adding the item and a web service/page method to handle the actual adding process behind the scenes. Then use javascript to add the new item to the dropdownlist.
Get GridView Selected Row Values using Page Previous Page

Get GridView Selected Row Values using Page Previous Page


By : nab
Date : March 29 2020, 07:55 AM
Hope that helps Note: PreviousPage is only != null with cross page posting, Response.Redirect will not work. So you could for example use Server.Transfer.
You could provide a public property SelectedConsumer that returns a custom object of the curerently selected row in the GridView.
code :
public Consumer SelectedConsumer
{
    get {
        if (grdConsumers.SelectedRow == null)
            return null;

        var c = new Consumer();
        c.consumerID = grdConsumers.SelectedRow.Cells[1].Text;
        c.consumerName = grdConsumers.SelectedRow.Cells[2].Text;
        c.consumerUrl = grdConsumers.SelectedRow.Cells[3].Text;
        c.consumerStatus = grdConsumers.SelectedRow.Cells[4].Text;

        return c;
    }
}
var consumerList = (ConsumerList)Page.PreviousPage;
var selectedConsumer = consumerList.SelectedConsumer;
How to retrieve the values from previous jsp page to result page?

How to retrieve the values from previous jsp page to result page?


By : Shanty Singh
Date : March 29 2020, 07:55 AM
this one helps. If you want data that can be access across multiple pages, consider using the session to store data. For example, if page1.jsp submits a form parameter, "page1Result" to page2.jsp, then in page2.jsp, do the following:
code :
String page1Result = request.getParameter("page1Result");
request.getSession().setAttribute("page1Result", page1Result);
String page1Value = (String)request.getSession().getAttribute("page1Result);
    <%
     String s1=request.getParameter("grp");
     request.getSession().setAttribute("s1", s1);
     %>
    <%
     String s2=request.getParameter("grp2");
     request.getSession().setAttribute("s2", s2);
     %>
out.println("Wrong Answer! The Correct Answer for question 2 is :"+session.getAttribute("s2"));
How to pass model values from previous page to new page post method using ajax?

How to pass model values from previous page to new page post method using ajax?


By : Shyam
Date : March 29 2020, 07:55 AM
hope this fix your issue https://dotnetfiddle.net/c7hAFy
Controller
code :
namespace Testy20161006.Controllers
{
    public class MyData
    {
        public string NeoData { get; set; }
    }

    public class HomeController : Controller
    {
        [HttpPost]
        //adding generic ActionResult to Task type
        public async Task<ActionResult> Progess(MyData mydata)
        {
            return View();
        }

        [HttpPost]
        public async Task<ActionResult> AddData(MyData mydata)
        {
            return View("AddDetails", mydata);
        }

        public ActionResult Tut137()
        {
            MyData myData = new MyData { NeoData = "neoData" };
            return View(myData);
        }
@model Testy20161006.Controllers.MyData 
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Tut137</title>
</head>
<body>
    @using (Html.BeginForm("AddData", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
    {
        @Html.TextBoxFor(r=>r.NeoData);
        <input id="theButton" type="submit" value="Go"  />
    }
</body>
</html>
@model Testy20161006.Controllers.MyData
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>AddDetails</title>
    <script src="~/Scripts/jquery-1.12.4.min.js"></script>
    <script type="text/javascript">
        $(function () {
            var someRootPath = "@Url.Content("~")";
            $.ajax({
                //rename Process to Progess to match call to method called
                url: someRootPath + 'Home/Progess',
                data: $('#AddData').serialize(),
                type: "POST",
            });
        })
    </script>
</head>
<body>
    <div>
        @Html.TextBoxFor(r => r.NeoData, new { id = "AddData" })
    </div>
</body>
</html>
How to move to the next page and then come back to previous page and also retaining its values ASP.net

How to move to the next page and then come back to previous page and also retaining its values ASP.net


By : Nicole Tarucan Bened
Date : March 29 2020, 07:55 AM
seems to work fine You can store the values in either Cookie or in a Session variable. Session variable is application specific and cookies are browser specific.
try this, for creating a session variable
Related Posts Related Posts :
  • How to make a sitemap using zend framework 1
  • Laravel: array to Model with relationship tree
  • $_SERVER['DOCUMENT_ROOT'] vs $path = $_SERVER['DOCUMENT_ROOT']
  • What is the best way to store multiple checkbox values in the database and work with it later on
  • Why does foreach copy the array when we did not modify it in the loop?
  • Receive Jquery/Ajax Post Request in PHP
  • How to better use the if(!empty()){ //codes} statement
  • PHP error mysql_close() boolean given
  • Move an image file from one server to another using PHP
  • PHP: Encoding non ISO-8859-1 charactrers into utf8
  • Handling MySQL errors in PHP
  • Object orientated mysql num_rows query in one line
  • Remove not closed html elements from end of text
  • Generate random ENUM value [PHP, MySQL]
  • Deleting data from table using jQuery and SQL
  • How to make sure the constructor is executed when I'm trying to reach a static property?
  • Trying to understand arrow next to PHP function
  • Form using external php file to show "Sucess"
  • WooCommerce - new shipping method - how to query individual product weights
  • Common integer representation over variable casting?
  • PHP - Prevent client from tampering the ID of a form
  • unexpected T_PUBLIC error
  • Types of testcases in PHPUnit
  • keeping a LDAP user logged in with PHP session
  • Detect if browser supports WebP format? (server side)
  • real_escape_string not cleaning up entered text
  • E-commerce products filter
  • Why having more than one test method in a file using Laravel raises error?
  • PHP Escaped special characters to html
  • Basic prepared statement not INSERTING
  • PHP combobox not showing in HTML table
  • MySql PHP row request to variable
  • Join two tables with one table has multiple rows matching
  • Looping through users with Instagram API requests is REALLY slow
  • Unable to add 30 days to date within loop
  • Return from mysqli_query() into array
  • php rename() function returns "No such file or directory" error
  • form submit inside navigation menu
  • PHP: reasons to use GET and POST request at the same time?
  • Is break; required after die() php
  • little depth of session in php
  • Authentication Logon page not working using PHP and Oracle on Apache / Windows 2008
  • Magento reindexing error product flat data
  • Laravel 4: Running composer when deploying to Heroku
  • Long Polling or WebSockets
  • How to use mysqli_stmt_bind_param for integers, boolean, etc
  • Determining the content of a link
  • MYSQL and PHP update events?
  • PHP explode all square bracket
  • Transparent hexagon-masked collage using PHP GD
  • Plugins or text do NOT show up on custom wordpress template
  • inserting data into mysqli database
  • Two arguments to closure function laravel
  • UnClear image exported by ffmpeg from mp4 file
  • is the time of computer and localhost same?
  • change custom data- value after ajax post success
  • Can We Restrict PHP Variables to accept only certain type of values
  • csv file is inserting a blank row in the last of other rows into mysql table
  • How to convert special characters in xml using php?
  • Mcrypt are very confusing
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org