chuy08 Posted November 7, 2006 Share Posted November 7, 2006 I have a simple web form that is posting values to an array called info like so:<input type="text" name="info['fname']" size="20"><input type="text" name="info['lname']" size="20">on the subsequent page I am calling for the array like so:$info = $_POST['info'];and then I am trying to fill the captured information into a printable form like so:<?php print $info['fname'] ?><?php print $info['lname'] ?>I am getting an Notice: Undefined index: fname in C:\Inetpub\wwwroot\lead_sheet.php on line 35. What am I doing wrong.When I attempt to print_r($_POST); the post is printed and the keys are all there just a defined on the previous page. Any help would be appreciated and I could post more code if necessary. Link to comment https://forums.phpfreaks.com/topic/26476-web-forms-and-array/ Share on other sites More sharing options...
kenrbnsn Posted November 7, 2006 Share Posted November 7, 2006 When using arrays as names in the HTML, you should not use quotes to delimite the indices.[code]<input type="text" name="info[fname]" size="20"><input type="text" name="info[lname]" size="20">[/code]Ken Link to comment https://forums.phpfreaks.com/topic/26476-web-forms-and-array/#findComment-121111 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.