Re: Populate input from another form

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08 Mar 2013 at 19:45, John Taylor-Johnston <john.taylor-johnston@xxxxxxxxxxxxxxxxxxxxx> wrote: 

> I have a form
>
> <form action="CRTP_Query.php" id="CRTP_Query" method="post"
> target="_CRTP"><input value="Query" form="CRTP_Query" type="submit"></form>
>
> OnSubmit, I want to include data from another form (form="DPRform").
>
> <input name="DPRsurname" type="text" form="DPRform" size="20"
> value="<?php echo stripslashes($_POST["DPRsurname"]);?>">
>
> I should use a hidden identical field and use form="CRTP_Query":
>
> <input name="DPRsurname" type="hidden" form="CRTP_Query" value="<?php
> echo stripslashes($_POST["DPRsurname"]);?>">

What purpose does this field serve?

> But I have no idea how to populate the hidden field with the data from
> the viewable field. PHP cannot do this onsubmit, can it?

You mean the script that processes the submitted page? No. Submitting causes your page to get replaced by the form's action, CRTP_Query.php in this case. Hmm, although it looks like you want a frame to receive the new page rather than replace the page. You'd probably need JavaScript to do that.

> Do I need to use jquery?

Avoid, IMO.

--
Cheers  --  Tim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux