note 35027 added to language.variables
| From: | wolex at dovecorporation dot com | Date: | Sat, 16 Aug 2003 05:56:25 +0000 |
| Subject: | note 35027 added to language.variables | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-54290@lists.php.net to get a copy of this message | ||
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. */
----
Manual Page -- http://www.php.net/manual/en/language.variables.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35027
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35027&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35027&report=yes