You are here: Re: Getting the dynamic 'name' with $_REQUEST[] , Pls help « PHP Programming Language « IT news, forums, messages
Re: Getting the dynamic 'name' with $_REQUEST[] , Pls help

Posted by Rami Elomaa on 06/26/07 15:07

sathyashrayan kirjoitti:
> 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>";

please change this to
print "<form name='more_url_comp' action='more_url_comp.php'
method='post'>";

Unquoted string literals make Tim Berners-Lee cry.

>
>
>
> 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*/

What the heck you mean it's not working? You're not using $test for
anything, how is it supposed to work?

>
>
>
> }
>
> 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.

In what array? What is it that you exactly want to do with it? How come
you're dealing with $_REQUEST (and by the way, you should always use
either $_GET or $_POST, depending what your form method is, never
$_REQUEST) even before the form is submitted, you're just outputting the
form, what would $_REQUEST contain at that point?

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

If I understand right, you're talking about having multiple values in
one database field? No, no, and no. Very wrong. Just use the extra table
like you intended. (Why: check out Codd's database normalization rules)

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

--
Rami.Elomaa@gmail.com

"Wikipedia on vähän niinq internetin raamattu, kukaan ei pohjimmiltaan
usko siihen ja kukaan ei tiedä mikä pitää paikkansa." -- z00ze

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация