|
-
May 4th, 2003, 02:20 PM
#1
Thread Starter
Fanatic Member
HTTP_POST_VARS question
I have a form that I dynamically create text boxes and the names respectively are text1, text2, text3, etc...... to text14.
When I click the submit button I am having issues with the $HTTP_POST_VARS code.
I just would like to know if I can do something like the following:
PHP Code:
for ($iArCnt=1; $iArCnt<15;$iArCnt++){
$sTmp = "text" . $iArCnt;
if (strlen($HTTP_POST_VARS($sTmp)) > 0){
$arFeature($iArCnt) = $HTTP_POST_VARS($sTmp);
} else {
$arFeature($iArCnt) = "";
}
}
Basically I would like to know how I can dynamically call each text.
Thanks in advance.
-
May 4th, 2003, 08:32 PM
#2
Stuck in the 80s
Yes, that should be able to work, however $HTTP_POST_VARS[] is deprecated. You should use $_POST[] instead (php 4.2+).
Try switching to $_POST[], and if it still doesn't work, get back to us and someone or I will help you figure it out.
-
May 5th, 2003, 04:09 PM
#3
Thread Starter
Fanatic Member
Yeah, I got it working but had some minor issues to change. Here is what I ended up with:
PHP Code:
for ($iArCnt=1; $iArCnt<15;$iArCnt++){
$sTmp = "text" . $iArCnt;
if (strlen($HTTP_POST_VARS[$sTmp]) > 0){
$arFeature[$iArCnt] = $HTTP_POST_VARS[$sTmp];
} else {
$arFeature[$iArCnt] = "";
}
}
My big mistake was using () instead of []
-
May 5th, 2003, 05:13 PM
#4
Stuck in the 80s
Originally posted by lleemon
Yeah, I got it working but had some minor issues to change. Here is what I ended up with:
PHP Code:
for ($iArCnt=1; $iArCnt<15;$iArCnt++){
$sTmp = "text" . $iArCnt;
if (strlen($HTTP_POST_VARS[$sTmp]) > 0){
$arFeature[$iArCnt] = $HTTP_POST_VARS[$sTmp];
} else {
$arFeature[$iArCnt] = "";
}
}
My big mistake was using () instead of []
Ah, I didn't catch that 
However, as I have previously stated, $HTTP_POST_VARS[] is deprecated and should not be used. Use $_POST[] instead.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|