note 35027 deleted from language.variables by didou
| From: | didou@php.net | Date: | Sat, 16 Aug 2003 08:45:49 +0000 |
| Subject: | note 35027 deleted from language.variables by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-54291@lists.php.net to get a copy of this message | ||
Note Submitter: wolex@dovecorporation.com
----
using the ampersand '&' for variable referencing could save you a lot of grief when
trying to move values from a form to your query object.
I hope this code snippet will make the point clear:
<----------- this is from file 1------>
<?php
echo '<form action="examp2.php" method="post">';
echo 'Example<input type="text" size="20" name="examp"
maxlenght ="40" />';
echo '</form>';
?>
<---------This is from file 2-----: examp2.php ------>
<?php
$exampos_ = &$_POST['examp']; /*will get you your values but skipping the & may
not: I was caught in this loop for a long time */
$dbquery = 'INSERT INTO your_db_table SET your_db_colum = '$exampos' ;
/*Of course the assumption is that you would have your syntaxes right and will connect to your db
before issuing queries. If you find this too cryptic, send me and email and I'll send you a
complete example code. */