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

  • Home
  • SEARCH
  • 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 8564331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:10:32+00:00 2026-06-11T17:10:32+00:00

page1.php $destinationCity = $_POST[‘destination’]; $sr = new searchArray(); $final = $sr->searcharray($destinationCity); echo <pre>; print_r($final);

  • 0

page1.php

$destinationCity = $_POST['destination'];
$sr = new searchArray();
$final = $sr->searcharray($destinationCity);
echo "<pre>";
print_r($final);
echo $final->vc[0];
echo "</pre>";

Page2.php

class searchArray {

public function searcharray($arr) {
   $rst = array();
   $length = strlen($arr);
    if ($length == 2){
        $sql = "select code from ukhotels where postcode LIKE '$arr%'";
        $rsd = mysql_query($sql);
        while($rs = mysql_fetch_array($rsd)){
        $co = $rs['code'];
        $vc = &$rst['vc'];
        $vi = &$rst['vi'];

        $vc[] = substr($co, 0, 2);
        $vi[] = substr($co, 3, strlen($co));

    }

    }

In page1 i am calling the function with one argument. In the page2 i am keeping the results in an associate array.

When I am printing the array from page1 its showing me output as

Array
(
[vc] => Array
    (
        [0] => CB
        [1] => RD
        [2] => RT
        [3] => YX
    )

[vi] => Array
    (
        [0] => 01461 
        [1] => 95101 
        [2] => 30818 
        [3] => 77126 
    )

)

i wanted to use the array in page1 like this

for($i=0, $j=1;$i<=20;$i++)
{
$params["VendorLocation"]["VendorCode"] = "{$final->vc[$i]}";
$params["VendorLocation"]["VendorLocationID"] = "{$final->vi[$i]}";
$params["VendorLocation"]["Key"] = "{$j}";
$j++;
}    

but it is throwing me an error saying ” Notice: Trying to get property of non-object “

Can any one please help me how to solve this issues.

Regards
Hailey

  • 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-06-11T17:10:33+00:00Added an answer on June 11, 2026 at 5:10 pm

    $final is an array, access the value like this :

    for($i=0, $j=1; $i<=20; $i++) {
        $params["VendorLocation"]["VendorCode"] = '{' . $final['vc'][$i] . '}';
        $params["VendorLocation"]["VendorLocationID"] = '{' . $final['vi'][$i] . '}';
        $params["VendorLocation"]["Key"] = "{$j}";
        $j++;
    }    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

page1.php echo '<form action=page2.php name=myform><table> <tr><td>name:<input type=text name=n></td></tr> <tr><td>Choose Desc<select name=desc value=0> $descriptions =
Page1.php: <?php session_start(); if ($_POST['password'] == testpass) $_SESSION['authenticated'] = true; ?> Page2.php <?php session_start();
I have a php page server1.com/page1.php (not real) and another page server2.com/page2.php page1.php response
I have the following pages: page1.php, page2.php and page3.php. Code in each of them
Suppose i have one website with simple pages in php like page1.php page2.php Now
I have page1.php that uses a form to send the following data: <form action=page2.php
here is my code... <select id=load> <option value=page1.php></option> <option value=page2.php></option> <option value=page3.php></option> </select> <div
I have the following code in page1.php : <a href=page2.php onClick=javascript:callFlash();>Go to page</a> This
Why does the execution continue after redirection using header() ? $flag=1; if($flag==1) header("Location:page1.php"); header("Location:page2.php");
I'm trying to select a specific class (in this case page1, page2, page3 etc.)

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.