I am new to PHP development and I have run into a problem with passing data between pages.
on one page I have the code :-
print "<td>";
print "<form method=\"post\" action=\"delete.php?deleteid=100\">";
print "<input type=\"submit\" value=\"DELETE\">";
print "</form></td>";
in delete.php I have the following code:-
print $deleteid;
I just wanted to print the data to see if I am passing it correctly. I get the following error:-
Notice: Undefined variable: deleteid in C:\Inetpub\wwwcintrainc\delete.php on line 14
I though I had this correct but no matter what I try I cannot get the data to appear in the delete.php page.
WHAT AM I DOING WRONG???????
Passing data between pages in PHP/HTML
Moderator: General Moderators
- daven
- Forum Contributor
- Posts: 332
- Joined: Tue Dec 17, 2002 1:29 pm
- Location: Gaithersburg, MD
- Contact:
Read this thread:
viewtopic.php?t=511
You need to use $_GET['deleteid'] to access the variable. A better way to make the form would be:
using POST variables
using GET variables
viewtopic.php?t=511
You need to use $_GET['deleteid'] to access the variable. A better way to make the form would be:
using POST variables
Code: Select all
<form action="delete.php" method="post">
<input type="hidden" name="deleteid" value="100">
<input type="submit" value="Delete">
</form>Code: Select all
<form action="delete.php" method="GET">
<input type="hidden" name="deleteid" value="100">
<input type="submit" value="Delete">
</form>Code: Select all
<?php
print $_POST['deleteid']; // if POST form
print $_GET['deleteid']; // if GET form
?>_get not working
I tried the $_get function and now it says that _get is an unrecognized variable. Do I need to include something in my file for this function or use a .dll file??????
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK