Jump to content

variable and string combination


collinPHP

Recommended Posts

I have these variables posted in from a form

 

text0,text1,text2,text3,text4

 

I use this to retrieve these variables being posted

 

import_request_variables(gp, "formval_");

$tx0 = $formval_text0;

$tx1 = $formval_text1;

$tx2 = $formval_text2;

$tx3 = $formval_text3;

$tx4 = $formval_text4;

 

This works perfectly, but what I want to do is this:

 

$hn=5;

$startnum=0;

import_request_variables(gp, "formval_");

while ($startnum < $hn) {

$text_stuff=formval_text.$startnum;

echo $text_stuff;

$startnum++;

}

 

This is what is outputted

formval_text0formval_text1...

 

what I want is the contents of:

formval_text0

formval_text1...

 

So, my problem arises with this line

 

$text_stuff=formval_text.$startnum;

 

How might I change this line to get: formval_text0 , formval_text1 , formval_text2 , ...

 

Thank you

Collin Thompson

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.