开发者

Send PHP array from one form to other in HTML

开发者 https://www.devze.com 2023-02-11 05:01 出处:网络
I have two forms. One reads a file using PHP and returns an array. I then what to send this array as an input to another form for some querying.

I have two forms. One reads a file using PHP and returns an array. I then what to send this array as an input to another form for some querying.

How do I go about it? Thanks

So far, I have something like this.

 <form  name ="INPUT" method="POST" enctype="multipart/form-data" ">
     <p id="upload_text"><br/>
        <textarea name="queryList" id="queryList" cols="35" rows="10" wrap="physical" value='' onclick ="document.INPUT.queryList.value='';">
        Enter input here...
        </textarea><br/>
     </p>
     <p>
        <input name=INPUTS type=hidden value=$entries[]/>
     </p>
     <p id="upload_button"><br/>
        File:
        <input action="readInput.php" name="uploadedfile" type="file" size="30" onchange='fillTextArea()'/><br/>
     </p>
        <iframe id="upload_target" name="upload_target" src="#" style="width:0;height:0;border:0px solid #fff;"></iframe>
     </form>

    <form  name ="SUBMIT_INPUT" action ="viewPDBs.php" method="POST" enctype="multipart/form-data"  >
        <p id="submit_upload">
            <input type="submit" name="submit" value="Submit" /><br/>
        </p>
        <p>
            <input name=IDS type=hidd开发者_如何学Pythonen value="<?php urlencode(serialize($entries)); ?>"/>
         </p>
     </form>


Although I don't full know what you want, and I think you are doing something that could be inefficient and also open to security holes, you can do this:

<?php foreach($entries as $k => $e) : ?>
<input type="hidden" name="entries[<?php echo $k ?>]" value="<?php echo addslashes($e) ?>">
<?php endforeach; ?>

Then once submitted, check the variable $_POST['entries'] and you will find it is an array

0

精彩评论

暂无评论...
验证码 换一张
取 消