Jump to content

MrGraphx

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

MrGraphx's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I am going crazy trying to figure out how to accumulate user responses, to post to an array, before submitting the data to a handling script. I create the array, with a maximum number of entries, and then I want the user to be able to go to as many fields in the array to entr different information. When they are finished, then submit it to a script that will print out each element of the array. In the example below, all I have is a previous and a next button. I will add the other submit button once I figure out how to use the next and previous ones. Any direction would be greatly appreciated. NOTE: When I press the next button, it will work one (1) time only and that is it. Here is the script: <?php $Info = $_POST["Info"]; $submit1 = $_POST["Previous"]; $submit2 = $_POST["Next"]; for ($i = 1; $i<= 5;$i++){ $a[] = "This is Number " . $i; } // Check to be sure the array was created echo "The array length is " . count($a) . "<br />"; // Load the length of the array into a separate variable $arr_length = count($a); // I have to flip the array to be able to select the // value I want to view $a = array_flip($a); $i = 0; echo "Array Length = " . $arr_length . "<br />"; ?> <html> <head> <title>Personal INFO</title> </head> <body> <form method="post" action="<?php if($_POST['Previous']){ if($i > 0){ $i--; } } if($_POST['Next']){ if($i < $arr_length){ $i++; } } ?>"> <input type = "text" width = "50" name = "Info" value = "<?php echo array_search("$i",$a) ;?>"> <br /> <br /> <input type="submit" value="Previous" name="Previous[]"> <input type="submit" value="Next" name="Next"> </form> </body> </html> [img src=\"style_emoticons/[#EMO_DIR#]/huh.gif\" style=\"vertical-align:middle\" emoid=\":huh:\" border=\"0\" alt=\"huh.gif\" /]
  2. [img src=\"style_emoticons/[#EMO_DIR#]/huh.gif\" style=\"vertical-align:middle\" emoid=\":huh:\" border=\"0\" alt=\"huh.gif\" /] I am now as bald as the smilie face posted, trying to figure out the logic to perform this task. Here is the problem: I am using PHP_SELF to gather information from a form to arrays. I want to use multiple buttons, one for SUBMIT, one for RESET, and another for ADD RECORD. The ADD RECORD button is so the user can add more information from the same form to the arrays. When submitted, I will pull the information from the array's with a WHILE loop, format the content, and email the results. Does anyone have a suggestion as to the best way to approach this????? Thanks
×
×
  • 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.