makamo66 0 Posted November 16 The file test2.php consists of these simple forms: <?php for($i=0; $i<=5; $i++){ echo "<form action='reset4.php' method='get' name='yourForm'>"; echo "<button type='submit' value='delete' name='remove_" . $i . "' class='deletebtn'>X</button>"; echo "</form>"; } ?> It submits to reset4.php which is this simple code: <?php header("Location: test2.php"); exit; for($i=0; $i<=5; $i++){ if (isset($_REQUEST["remove_$i"])){ echo "Deleted"; }} ?> But it doesn't work. The $_REQUEST doesn't populate the address field and it apparently never gets submitted to reset4.php like it should. This is such a simple program, I can't imagine why it doesn't work. Quote Share this post Link to post Share on other sites
benanamen 114 Posted November 16 The first thing you do is issue a redirect and kill the script. How do you expect it to do anything after that? Quote Share this post Link to post Share on other sites
makamo66 0 Posted November 16 When I remove exit it still doesn't work. Quote Share this post Link to post Share on other sites
ginerjm 233 Posted November 16 Why do you begin the second script with a leap to ANOTHER script? Makes no sense at all. Quote Share this post Link to post Share on other sites
makamo66 0 Posted November 16 When I do the following, it still doesn't work: <?php for($i=0; $i<=5; $i++){ echo "<form action='' method='get' name='yourForm'>"; echo "<button type='submit' value='remove_" . $i . "' name='delete' class='deletebtn'>X</button>"; echo "</form>"; } for($i=0; $i<=5; $i++){ if (isset($_REQUEST["remove_$i"])){ echo "delete"; echo "Received Value: " . $_REQUEST["remove_$i"]; } } ?> Quote Share this post Link to post Share on other sites
NotSunfighter 0 Posted November 16 Your problem is in the reset4.php file remove both of these line: header("Location: test2.php"); exit; The problem you started with is the file test2.php - your running this instead of reset4.php Quote Share this post Link to post Share on other sites
Barand 1,389 Posted November 16 When your button's name is "delete" why are you checking for $_REQUEST["remove_$i"] instead of $_REQUEST['delete'] ? Stop using REQUEST. Use POST or GET depending on your form's method. if you are fetching data to display, use method GET. If submitting your form has consequences (such as updating, deleting, emailing) then use POST method. Quote Share this post Link to post Share on other sites