Jump to content

Array problem (Please help!!)


Newbrict

Recommended Posts

I have a form which submits fields into an associative array like this:

 

IP Addcress: <input id="IP Address" name="Saves['IP Address']" type="text">

Line: <input id="Line" name="Saves['Line']" type="text">

 

If I input "a" into Line and "b" into IP Address then submit my forum to a page that does this

 

$Saves = $_GET['Saves'];

print_r($Saves);

echo $Saves['Line'];

 

Array(['Line'] => a ['IP Address'] => b ) this is the print_r

nothing was outputted for $_Saves['Line']

 

 

 

I really need to be able to output $Saves['Line'], no clue what the problem is.

Link to comment
Share on other sites

Your problem lays within the single quotes:

 

<input id=:"Line" name="Saves['Line']" type="text">

 

Should be:

 

<input id="Line" name="Saves[Line]" type="text">

 

Same goes for the IP, remove the single quotes around IP Address in the html input tag, and your code will work.

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.