|
Posted by Jerry Stuckle on 06/27/07 01:19
sathyashrayan wrote:
> Dear Group,
>
> Please look at the following demo link.
>
>
>
> http://www.itsravi.com/demo/new_pms/admin/addproject.php
>
>
>
> I am trying to implement the "more attachment" and "more url" tasks in that
> page. The data base design is like this. Keeping a separate table for the
> "more file upload" (File uploaded directly to mysql). If the user closes
> after simply uploading the files without submitting the whole project
> information, or an exception occurs then the db table with extra files and
> url is inserted un-necessary. So I thought to put all the uploaded
> information in a array. At the end of submitting the full project
> information in the db the array values will get stored in the corresponding
> url and file table which is the child table which has got the FK key points
> to the corresponding project (parent)table.
>
>
>
> Following is the code I wrote for inputting the multiple url upload.
>
>
>
> <?php
>
>
>
> $number_tot = $number; /*if 3 given in the text box then 3 box to get urls*/
>
> print "<form name=more_url_comp action=more_url_comp.php method=post>";
>
>
>
> for($i=1 ; $i<= $number_tot ; $i++)
>
> {
>
> print "More Url $i:<input type='text' name='url_comp_'.$i><br>";
>
> $more_url_comp[] = "url_comp_".$i; /*All the url name array*/
>
>
>
> $test = $_REQUEST['url_comp_'.$i]; /*This is not wrking*/
>
>
>
> }
>
> echo '<input type="submit" name="more_comp_url" value="Upload Now!">';
>
> print "</form>";
>
>
>
> I got really stuck with the following. I don't know who to get the
>
> $test = $_REQUEST['url_comp_'.$i]
>
> in a array. Since the variable $i getting appended in the end. If, on the
> other hand, I use array in the name of the text box such as text[], then can
> I use serialize and unserialize function. If this can be done then there is
> no need to use a separate db table to hold the value for url. Or I am
> missing some thing very basic.?
>
> I have not started to implement this with multiple file upload to the
> mysql directly. I don't know what could be the problem that will arise in
> that situation.
>
>
>
> Any help will be very help full. Thanks.
>
>
First of all, when setting the url, your current code is generating:
More Url 1:<input type='text' name='url_comp[]'><br>
First of all, IMHO since you're posting the form, you should use
$_POST['xxx'] instead of $_REQUEST['xxx']. Just a little safer; the
former works only with POSTed values; your way works with either $_POST
or $_GET (potential security exposure).
To get it from this array, you can use:
$url_array= array();
foreach ($POST['url_comp'] as $url)
$url_array[] = $url;
Also remember - unless you save these values, i.e. in the $_SESSION,
they will only exist for this one page.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|