Two things:
(1) Variable names are case sensitive, so $ret is not the same thing as $RET.
(2) You may not have everything set up properly to read the data area.

Task 1: Get the variable to show up on the page in html tags.
<?php
$ret = "this is a test";
echo "<h2 class=bigbluetext> $ret </h2>";
?>

Task 2: Populate the variable by reading the data area.

You can test whether or not you are actually reading the data area with something like this:
$ret = i5_data_area_read("smpxxlib/so01p", 1, 40);
if (!$ret) echo "Did not read data area. <br>";

Have you established a connection to the iSeries? You have to connect to the iSeries before you can execute the i5 commands (like i5_data_area_read).
Are you sure the i5_COMD service is running? You may have to go to the Zend core menu and start the i5_COMD service.

Kelly

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Grizzly Malchow
Sent: Thursday, February 04, 2010 9:52 AM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] Help trying to display a PHP variable within HTML tags

I can't tell by what you posted, but are you requiring Connection.php and creating the connection prior to using i5_data_area_read in the section code that doesn't work?


-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On Behalf Of Tom Deskevich
Sent: Thursday, February 04, 2010 9:45 AM
To: 'Web Enabling the AS400 / iSeries'
Subject: [WEB400] Help trying to display a PHP variable within HTML tags

Did not make any difference

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On
Behalf Of Grizzly Malchow
Sent: Thursday, February 04, 2010 10:30 AM
To: Web Enabling the AS400 / iSeries
Subject: Re: [WEB400] Help trying to display a PHP variable within HTML tags


Change this
echo "<H2 class=bigbluetext> $RET </h2>";
to
echo "<H2 class=bigbluetext> $ret </h2>";


-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx] On
Behalf Of Tom Deskevich
Sent: Thursday, February 04, 2010 9:18 AM
To: 'Web Enabling the AS400 / iSeries'
Subject: [WEB400] Help trying to display a PHP variable within HTML tags

I want to display a PHP variable on the top of my page with my headings. I
have searched on the internet, and have not found a way to show the php
variable within my html tags. If I use text in the heading, it works. But
when using a variable, nothing shows. I have tried many variations. I know
there is something in the data area, because it works if I move it to my
main body of php code.

<html>
<head>
<link rel="stylesheet" href="styles.php" type="text/css">
<TITLE>Sheriff Consolidated Inquiry</TITLE>
</head>

<h1 class=bigbluetext font size="+2"> Sheriff System Consolidated Inquiry
</h1> <?php
$ret = i5_data_area_read("smpxxlib/so01p", 1, 40);
echo "<H2 class=bigbluetext> $RET </h2>";
?>
<form method="post">
Name:

DOES NOT SHOW ANYTHING.

<html>
<head>
<link rel="stylesheet" href="styles.php" type="text/css">
<TITLE>Sheriff Consolidated Inquiry</TITLE>
</head>

<h1 class=bigbluetext font size="+2"> Sheriff System Consolidated Inquiry
</h1> <?php
$ret = i5_data_area_read("smpxxlib/so01p", 1, 40);
echo "<H2 class=bigbluetext> I shot the sheriff.... </h2>";
?>
<form method="post">
Name:

WORKS.

ALSO.... Putting the code in my <PHP section works.......

Name:
<input tabIndex="1" size="30" name="ppname">
<INPUT TYPE="submit" VALUE=" Find ">
EXAMPLE: smith OR smith j OR smith john
<hr />
</html>
<?php
if(isset($_POST['ppname'])){
require_once('Connection.php');
try {
$conn = new Connection();
} catch (Exception $e) {
echo "Failure to connect";
echo $e->getMessage();
die();
}
$fdname=$_POST['ppname'];
$ret = i5_data_area_read("smpxxlib/so01p", 1, 40); <<<<=== Works here
!!!
echo "<H2 class=bigbluetext> $ret </h2>";
$desc = array (

TIA

Tom Deskevich



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.