Re: Sending a PHP array from an HTML form



On Wed, 12 Dec 2007 18:32:20 -0800 (PST), Kevin <kevin@xxxxxxxxxxxxxx>
wrote:

On Dec 12, 6:28 pm, Jerry Stuckle <jstuck...@xxxxxxxxxxxxx> wrote:
Kevin wrote:
I have a PHP array named $CurrentDate[]

I have a simple html form.

<form name='MyForm' method='post' action='Calendar.php'>
<input name="FirstName" type="text">
<input name="LastName" type="text">
<input name='submit' type='submit' value='submit'>
</form>

How do I send the $CurrentDate[] array with the form to the
Calendar.php page?

Store it in the session or as a hidden field in your form.

Every time the user goes to a new page, everything previous to that page
is lost unless it's store in the $_SESSION variable or is sent with the
request (i.e. a hidden field).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@xxxxxxxxxxxxx
==================

I guess I was not clear. I want to store it as a hidden field in the
form, but how do I make the hidden field send the contents of the
array?

I think this is what you need:

<input type="hidden" value="<?php echo $CurrentDate; ?>">

or

<input type="hidden" value="<?php echo serialize($CurrentDate); ?>">

hope this helps,

GD
.



Relevant Pages

  • Re: receipt of form values by an HTML page
    ... There's a difference between failing a validation check due to ... I'd be inclined to store that pointer in a hidden field rather ... on the client: less load on the database (if indeed there's a database ...
    (comp.infosystems.www.authoring.html)
  • Re: Querystring
    ... The only way to really do this is to store them in a Session. ... would write them to a hidden field a person could change them and resubmit ... > How do i ensure in page B that my Querystring is not ALTERED by somebody. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: [PHP] Passing var from one page to itself
    ... you can store info in hidden form fields. ... changed the hidden field values before it gets sent to the 3rd page. ... The page is passing the vars from the first page to the second, ...
    (php.general)
  • Re: Sending a PHP array from an HTML form
    ... Store it in the session or as a hidden field in your form. ...
    (alt.php)
  • Re: Sending a PHP array from an HTML form
    ... How do I send the $CurrentDatearray with the form to the ... Store it in the session or as a hidden field in your form. ... JDS Computer Training Corp. ...
    (alt.php)