It seems like it would be very simple but for some reason I'm going around
and around on this.



My PHP skills are minimal to start with but this seems like it should not
be this hard.



What I want to do is display a table with two fields in it. In one field,
the user is prompted to enter their name. I then call an RPG program and I
want to return a message to the program showing what the name entered was
and then display that in the second field in my table.



However, when I run the script, I first get an "undefined variable" message
on Z_MsgField (even if I name it O_MsgField, fyi).



When I enter a name and submit the script, the function works (i.e., the
RPG program is called correctly and returns the correct message) but both
fields in the table are blank.



I expected to see both the name entered and the message returned in the
table fields as I defined them as output fields too on the program call.



What am I doing wrong here?









<body>



<?php





echo "<form method='POST' name='form1' action=".$_SERVER['PHP_SELF'].">";



echo "<input type='hidden' name='_submit_check' value='1'/>";

echo "<table border='2' cellpadding='0' cellspacing='0'
style='border-collapse: collapse' bordercolor='#111111' width='60%'
height='268'>";

echo "<tr>";





if (array_key_exists('_submit_check', $_POST))

{

$conn = i5_connect("192.168.0.1", "User", "Pass");

if (!$conn)

{



($description =
file_get_contents("/www/zendcore/htdocs/phptest1.pcml"))

or trigger_error("Error
while opening PCML file", E_USER_ERROR);




($hdlPgm =
i5_program_prepare_PCML($description))

or trigger_error("Error
while parsing PCML: " . i5_errormsg(), E_USER_ERROR);




if (isset($_POST['I_InName']))

{

$in_parameters = array(
"I_InName"=>$_POST['I_InName'] );

}





$out_parameters = array(

"I_InName"=>"I_InName",

"O_MsgField"=>'Z_MsgField' );






i5_program_call($hdlPgm, $in_parameters, $out_parameters)

or trigger_error("Error while executing
program: " . i5_errormsg(), E_USER_ERROR);



} // end connection good block







echo "<td width='22%' height='36'><u><font
size='6'><b>Name: </b></font></u></td>";

echo "<td width='178%' height='36'>";

echo "<input type='text' name='I_InName' size='60'>
</td>";

echo "</tr><tr><td width='22%' height = '36'><u><font
size='6'><b>Msg:</b></font></u></td>";

echo "<td width='178%' height='36'><input type='text'
name='O_MsgField' size=80 value='".$Z_MsgField."'></td>";

echo "</tr>";





} // End array_key_exists('submit_check')





echo "</table>";

echo "<input type='submit' value='Submit' name='B1'><input type='reset'
value='Reset' name='B2'>";

echo "</form>";



?>



</body>







Shannon O'Donnell




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.