Hi,

when you create an array its pretty simple but how can i put it in the actual address? example: you insert a text box

<label>
   $array = "25"

 <textarea name="textarea" id="textarea" value='$array' cols="45" rows="5"></textarea>
  </label>

So this should put 25 in the box
but, is there away to put the array in the address


example: gamershotel.com/account.php?25

Does anyone know how to put the array in the address bar so it will come up in the text box? or even echo $array?

Thanks, Chris

Member Avatar for diafol

Hi,

when you create an array its pretty simple but how can i put it in the actual address? example: you insert a text box

<label>
   $array = "25"

 <textarea name="textarea" id="textarea" value='$array' cols="45" rows="5"></textarea>
  </label>

So this should put 25 in the box
but, is there away to put the array in the address


example: gamershotel.com/account.php?25

Does anyone know how to put the array in the address bar so it will come up in the text box? or even echo $array?

Thanks, Chris

1. The $array variable isn't an array
2. The variable can be passed to the receiving url thus (in the format that you suggested):

<form action="nextpage.php?<?php echo $array;?>" method="post">

3. To place the value into a textbox or textarea:

<input type="text" id="whatever" name="whatever" value="<?php echo $array;?>" />

and

<textarea name="textarea" id="whatever2" name="whatever2" cols="45" rows="5"><?php echo $array;?></textarea>

4. Don't encompass widgets within labels. Labels as a rule will come before the text/textarea widgets. They should have a 'for' attribute linked to the id value of the widget:

<label for="whatever">Whatever...</label>
<input type="text" id="whatever" name="whatever" value="<?php echo $array;?>" />

Sorry, not trying to be funny, but read up on your html before tackling php, it will save a lot of hassle when having to deal with $_POST/$_GET etc.

I wonder whether you need to pass the $array variable via querystring (url in address bar) AND through the form (post method). Please clarify - are you accepting the $array variable from the url and then passing it to the form? If so, your querystring will probably need some tweaking:

<form action="nextpage.php?[B]id=[/B]<?php echo $array;?>" method="post">

The 'id' will now be the focus for the $_GET variable (value = $array).

I'm a little confused.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.