PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > alt.php > Sending a PHP array from an HTML form
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Sending a PHP array from an HTML form

Réponse
 
LinkBack Outils de la discussion
Vieux 13/12/2007, 02h09   #1
Kevin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Sending a PHP array from an HTML form

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?
  Réponse avec citation
Vieux 13/12/2007, 02h28   #2
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Sending a PHP array from an HTML form

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.
jstucklex@attglobal.net
==================

  Réponse avec citation
Vieux 13/12/2007, 02h32   #3
Kevin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Sending a PHP array from an HTML form

On Dec 12, 6:28 pm, Jerry Stuckle <jstuck...@attglobal.net> 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...@attglobal.net
> ==================


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?
  Réponse avec citation
Vieux 13/12/2007, 04h09   #4
Jerry Stuckle
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Sending a PHP array from an HTML form

Kevin wrote:
> On Dec 12, 6:28 pm, Jerry Stuckle <jstuck...@attglobal.net> 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...@attglobal.net
>> ==================

>
> 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?
>


serialize() it.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

  Réponse avec citation
Vieux 13/12/2007, 22h01   #5
NN
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Sending a PHP array from an HTML form

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

>On Dec 12, 6:28 pm, Jerry Stuckle <jstuck...@attglobal.net> 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...@attglobal.net
>> ==================

>
>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 s,

GD
  Réponse avec citation
Vieux 14/12/2007, 06h27   #6
Kevin
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Sending a PHP array from an HTML form

Yes. Thank you!
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 18h41.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,14820 seconds with 14 queries