[PHP] Passing variables to a PHP script on clicking a hyperlink
Hello, How can I pass variables on clicking a hyperlink to a PHP script? I have 5 hyperlinks, all pointing to the same PHP script. However, on clicking each hyperlink a different value of the variable needs to be passed to the PHP script. i.e. I have 5 databases from which I want to obtain information, however the information should be displayed only when the user clicks on the hyperlink for that database. How can I pass the database name to the PHP script? How would the script know which database to get information from? I am new to PHP so any help would be greatly appreciated. I hope my question is clear. Thanks, Suamya. -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink
Thank you all for the help. I did not want to use dropdown box..that was the very reason i was wondering if I can pass the variables through a hyperlink. I used $_GET and it worked fine. However, as mentioned in the posts its not advisable to use $_REQUEST. Could you please elaborate on the reason? This brings me to another question I have registered a variable as a session variable so that I can use it on any page during that session. HOwever, this was not working when I first tried it. I read somewhere that I need to enable register_globals. On doing so, it worked and I could access my session variable on any other page. Is this wrong? Is there an alternative? Please suggest. - suamya > On 8/24/07, Goltsios Theodore <[EMAIL PROTECTED]> wrote: >> the posted or got option buy using the $_REQUEST array ($_GET and $_POST >> are >> included in that like a less lame solution). Let's say you have a > > Please do not encourage the use of $_REQUEST. > > You might as well just tell people to enable register_globals again. > > Use $_GET, $_POST, $_SESSION, $_COOKIE, $_SERVER, etc. for the > appropriate source of data. $_REQUEST is laziness and introduces most > of the same issues that was the reasoning behind disabling > register_globals to begin with. > > (As for dropdowns, that's just an in-browser method of collecting data > and sending the key/value pairs in POST or GET... IMHO the HTML > portion should already be known before someone steps into the realm of > PHP and server-side programming) > > - mike > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean. > > -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [PHP-DB] Re: [PHP] Passing variables to a PHP script on clicking a hyperlink
Hi.. in the settings, session.use_cookies is turned ON but session.trans_sid is turned OFF. do i need to enable this as well? by doing this can i disable the register_globals? - suamya > Hi > Me again > Check on Your setting -> ; Whether to use cookies. > session.use_cookies = 1 > session variable is saved here if the user have cookies turned off it will > still work if your have trans-sid turn on. > BTW you don't have to use a dropdown radio buttons or tick box will work > as > well > Johan > ""Suamya Srivastava"" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Thank you all for the help. >> I did not want to use dropdown box..that was the very reason i was >> wondering if I can pass the variables through a hyperlink. I used $_GET >> and it worked fine. However, as mentioned in the posts its not advisable >> to use $_REQUEST. Could you please elaborate on the reason? >> This brings me to another question >> I have registered a variable as a session variable so that I can use it >> on >> any page during that session. HOwever, this was not working when I first >> tried it. I read somewhere that I need to enable register_globals. On >> doing so, it worked and I could access my session variable on any other >> page. Is this wrong? Is there an alternative? Please suggest. >> >> - suamya >> >> > On 8/24/07, Goltsios Theodore <[EMAIL PROTECTED]> wrote: >> >> the posted or got option buy using the $_REQUEST array ($_GET and > $_POST >> >> are >> >> included in that like a less lame solution). Let's say you have a >> > >> > Please do not encourage the use of $_REQUEST. >> > >> > You might as well just tell people to enable register_globals again. >> > >> > Use $_GET, $_POST, $_SESSION, $_COOKIE, $_SERVER, etc. for the >> > appropriate source of data. $_REQUEST is laziness and introduces most >> > of the same issues that was the reasoning behind disabling >> > register_globals to begin with. >> > >> > (As for dropdowns, that's just an in-browser method of collecting data >> > and sending the key/value pairs in POST or GET... IMHO the HTML >> > portion should already be known before someone steps into the realm of >> > PHP and server-side programming) >> > >> > - mike >> > >> > -- >> > PHP Database Mailing List (http://www.php.net/) >> > To unsubscribe, visit: http://www.php.net/unsub.php >> > >> > >> > -- >> > This message has been scanned for viruses and >> > dangerous content by MailScanner, and is >> > believed to be clean. >> > >> > >> >> >> -- >> This message has been scanned for viruses and >> dangerous content by MailScanner, and is >> believed to be clean. > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > This message has been scanned for viruses and > dangerous content by MailScanner, and is > believed to be clean. > > -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sending multiple values from a form having same field names.
Hi, How can I send multiple values from a form to be stored in a database, as name of the fields is the same? For example: "; } elseif ($datatype=="textarea") { echo ""; } echo ""; } ?> This creates a form with field names and text box or textarea box next to each field name depending on the datatype. After the user enters the values in the text or textarea and clicks submit, the values should get stored in a database. But what is happening is that only the value entered in the last field of the form is getting entered into the database. This code is embedded in an application which is having an inbuilt structure of taking the values from a form in a hash. Since key is the same (i.e. field_id) everytime, the value gets overwritten and only the last value gets stored in db. But I am not able to work out a solution for this. I hope I am able to make my problem clear enough. Thanks, Suamya. - DISCLAIMER:- "The information in this e-mail is confidential, and is intended solely for the addressee or addressees. If you are not the intended recipient, please delete the mail and kindly notify the sender of misdelivery. Any unauthorised use or disclosure of the contents of the mail is not permitted and may be unlawful." - "Scanned By MailScanner" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending multiple values from a form having same field names.
Hi, Thanks all for the help. I suffixed all the field names in the form with field id, like name=field_name_fieldid and fetched it as an associative array. Thanks, Suamya > Eric Butera wrote: >> On Fri, Mar 14, 2008 at 6:02 AM, Zoltán Németh >> <[EMAIL PROTECTED]> wrote: >>> 2008. 03. 14, péntek keltezéssel 14.08-kor Suamya Srivastava ezt >>> Ãrta: >>> >>>> Hi, >>> > >>> > How can I send multiple values from a form to be stored in a >>> database, as >>> > name of the fields is the same? >>> > >>> > For example: >>> > >>> > >> > foreach ($field_data as $field) { >>> > >>> > $field_name=$field["field_name"]; >>> > $field_id=$field["field_id"]; >>> > $datatype=$field["datatype_name"]; >>> > >>> > ?> >>> > >> /> >>> > >>> > >>> > >> > if ($datatype=="text" || $datatype=="integer") { >>> > echo ">> name=\"field_data\">"; >>> >>> make field_data an array indexed by field_id >>> >>> >> >>> greets, >>> Zoltán Németh >>> >>> >>> >>> > } >>> > elseif ($datatype=="textarea") { >>> > echo ">> > name=\"field_data\">"; >>> > } >>> > echo ""; >>> > } >>> > ?> >>> > >>> > This creates a form with field names and text box or textarea box >>> next to >>> > each field name depending on the datatype. After the user enters the >>> > values in the text or textarea and clicks submit, the values should >>> get >>> > stored in a database. But what is happening is that only the value >>> entered >>> > in the last field of the form is getting entered into the database. >>> > This code is embedded in an application which is having an inbuilt >>> > structure of taking the values from a form in a hash. Since key is >>> the >>> > same (i.e. field_id) everytime, the value gets overwritten and only >>> the >>> > last value gets stored in db. But I am not able to work out a >>> solution for >>> > this. >>> > I hope I am able to make my problem clear enough. >>> > >>> > Thanks, >>> > Suamya. >>> > >>> > >>> > >>> > >>> > >>> - >>> > DISCLAIMER:- >>> > "The information in this e-mail is confidential, and is >>> intended >>> > solely for the addressee or addressees. If you are not the intended >>> recipient, >>> > please delete the mail and kindly notify the sender of misdelivery. >>> Any >>> > unauthorised use or disclosure of the contents of the mail is not >>> permitted >>> > and may be unlawful." >>> > >>> - >>> > >>> > "Scanned By MailScanner" >>> > >>> > >>> >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> >> >> Since Zoltán give you the answer I might give you another fish. Which >> one is more readable: >> >> >> >> >> > if ($datatype=="text" || $datatype=="integer") { >>echo ""; >> } >> elseif ($datatype=="textarea") { >> echo "> name=\"field_data\">"; >> } >> echo ""; >> } >> ?> >> >> >> >> >> >> >> >> >> >> >> > name="field_data"> >> >> >> >> >> > > This is more readable > > while ( $row = mysql_fetch_row($result_set) ) { > ># Extract all data fields from result set >list($datatype
[PHP] Unzipping file through PHP
Hi, I am writing a code to upload multiple files on the server using PHP. I zipped the folder containing these files, uploaded the zipped file through my application on the server. Now,I am trying to unzip the .zip file using PHP. I tried it in different ways using: 1. `unzip filename.zip` 2. system ("unzip filename.zip") 3. system (`unzip filename.zip`) but it doesnt seem to work. However, the same commands work from command line. anybody has any ideas what might be wrong here? Thanks, Suamya. - DISCLAIMER:- "The information in this e-mail is confidential, and is intended solely for the addressee or addressees. If you are not the intended recipient, please delete the mail and kindly notify the sender of misdelivery. Any unauthorised use or disclosure of the contents of the mail is not permitted and may be unlawful." - "Scanned By MailScanner" -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php