Re: how can i use a link as a session var

From: Date: Mon, 30 Oct 2000 16:45:33 +0000
Subject: Re: how can i use a link as a session var
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-4049@lists.php.net to get a copy of this message
The "mysql_connect" function establishes a non permanent connection that will be automatic closed when the scripts finished its work. If you want to use the same mysql connection you should use "mysql_pconnect" instead. Jayme. http://www.conex.com.br/jjeffman -----Mensagem Original----- De: <luis@mecha.barry.edu> Para: deryk <deryk@163.net>; <php-db@lists.php.net> Enviada em: segunda-feira, 30 de outubro de 2000 00:34 Assunto: Re: [PHP-DB] how can i use a link as a session var > First off, I am a newbie so take my advice with a grain of salt!! > > As far as I can tell there are 2 ways of passing values ... and the problem is > not in passing values from one page to another (that is automatic), but in > passing values to a third page. > > The first is to pass the value along in the url for the next page, as when you > see on many websites a variable=value pair in the url string > (http://someplace.com/query.php?var1=ten&var2=another_val)..this is > traditionally passed along from a form using the GET method. The way you would > do this is to construct the url on page1...like echo "<a > href=\"query.php?$var_for_next_page\">link to page 2</a>"; > The next way to pass a value is by using a form and the post method. When using > the post method, all form variables get passed in an array called > $HTTP_POST_VARS. This is a really nice and handy way to pass variables along > because if your form vaiables were name, date, city, what you will get in > http_post_vars on the next page is > $HTTP_POST_VARS[name] > $HTTP_POST_VARS[date] > $HTTP_POST_VARS[city] > > So if you need to send a value to a 3rd page, you can include it in a hidden > element<INPUT TYPE=hidden NAME="hidden_name" VALUE="hidden_value"> > and the user > will never see the value. > > You can combine the 2 ways and have all interactivity take place on one page, > and keep things manageable...you can construct such a beast by using the "meat > patty" type of structure such as the following, where the head and foot are > static top and bottom of your html page but the dynamic is the middle, > represented by the functions: > > include(html_header.php); > file://where you split your html into a head and foot > > switch ($mode){ > case "add" > function_one() > case "del" > function_two() > } > include (html_foot.php); > > and depending how you call your page (thing.php?mode=add or thing.php?mode=del) > is how you navigate through your different parts of the thing... > > I have already gone on too long > > HTH, > > Luis > > --- deryk <deryk@163.net> wrote: > > can anyone help me: > > in the following > > <? > > $link=mysql_connect("localhost","user","password"); > > ?> > > i want to use $link as a session var to transfer to > > another > > page,but it does't work,I don't know what happened > > or what > > to do,I need help. > > thx > > > > > > > > > > -- > > PHP Database Mailing List (http://www.php.net/) > > To unsubscribe, e-mail: > > php-db-unsubscribe@lists.php.net > > For additional commands, e-mail: > > php-db-help@lists.php.net > > To contact the list administrators, e-mail: > > php-list-admin@lists.php.net > > > > > --------------------------------------------- > This message was sent using Mecha WebMail. > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.db (#4049) next »