timi2shoes Posted December 9, 2006 Share Posted December 9, 2006 Hello there,I have a small script that grabs data from a form that has been submited to me, but i cant figure out howo to get the data that has been passed to me and pass that again and submit it as a form to a php script.thank you. Quote Link to comment https://forums.phpfreaks.com/topic/29997-passing-data-from-php-variables-to-a-html-form/ Share on other sites More sharing options...
ted_chou12 Posted December 9, 2006 Share Posted December 9, 2006 first, we need to know how you stored the data, but if i assume you store it as a text file, then it would be like this:[code]<?php$data = @file("data.txt"); // collect all data into an arrayforeach($data as $v){list($fish,$cats) = explode("#",$v); // split up the differnt parts of the data with # sign?>[/code]The above is getting the data from the text files, if you want to use this style of coding, please separate your different parts of data with # symbol. and then you have already set the data into strings!Now lets put them into the form:[code]<form name="test" action="" method="post"><table><tr><td>fish:</font></td><td><input name="fish" type="text" id="fish" rows="11" cols="57" style="font-family: Arial" value="<? echo "$fish" ?>"></td><tr><td valign=top><font face="Arial">cats:</td></font><td><textarea name="cats" id="cats" rows="6" cols="57" style="font-family: Arial"><? echo "$cats" ?></textarea></td></tr>[/code]this is the formthere are two types ive shown here, one is text area, the other is input box, so far i am still having trouble myself with the combo boxes.hope it helpedTED. :D Quote Link to comment https://forums.phpfreaks.com/topic/29997-passing-data-from-php-variables-to-a-html-form/#findComment-138030 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.