Jump to content

Setting a form element value = to existing array?


rbragg

Recommended Posts

Is it possible to set a form element value to an existing array? For example, I have an array called $app:

 

<?php
while (ocifetch($stmt1)) {
  $app = ociresult($stmt1, "FIELD"); # this is an array populated by a query results
  echo "<input type='checkbox' name='reminders[]' value='" . $app . "'>";
}
?>

 

Ultimately, I would like the values in $app to be added to the reminders[] array. Is this possible or can someone divulge a way to do this?

 

Thanks in advance.  ;D

Best way to do this IMO is to store $app in a session to carry it to the next page... use the checkbox as a boolean

 

<input type="checkbox" name="useApp" value="1"> Use $app?

 

Then check for it

 

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

    print_r( $_SESSION['app'] );

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.