Help - Search - Member List - Calendar
Full Version: Form passing data question
WorkTheWeb Forums > Webmaster Resources > PHP Help
Support our Sponsors!
Lee David
I tried to get an answer to this in a different newsgroup, but no one there
seemed to know. Perhaps someone here can help me with it. I'm sure I'm
making a pretty simple mistake.

I would like to display a form, populate a select box, let the user select
one of the entries and then use that data in a different page.
Specifically, I have a page that has four buttons (add, list, change,
delete). If you click a button, that page calls itself with an include for
the selected function.

If you selected the delete or change button, you get an include of all the
possible record keys. This is the one that will allow you to select which
record to change or delete. The form looks like this:

<form method="post" action="SQL_Notice.php?act=Change&pass_id=">
<input name="postaction" type="hidden" value="selectnotice">
<table align="left">
<tr>
<td align="center" width="50%">
<select name="noticechange" size="4">
<option value="2005-06-03 12:06:11Dave"> Dave 2005-06-03 12:06:11
<option value="2005-06-03 03:06:44Dave"> Dave 2005-06-03 03:06:44
<option value="2005-06-03 03:06:18Dave"> Dave 2005-06-03 03:06:18
<option value="2005-06-03 02:06:54Dave"> Dave 2005-06-03 02:06:54
<option value="2005-06-03 02:06:01Dave"> Dave 2005-06-03 02:06:01
</select></td>
<td align="right">
<br><br>
<input name="submit" type="submit"><br><br></td></tr>
</table>
</form>

The "&pass_id=" should have the value selected, but I'm not sure how to get
it into there or if that is even the right way to be looking at it. Once
the "Change" include is called, it will populate a form with the data for
that specific record with a button to click after changing something. Or
the "Delete" include will display the record to verify it is the right one
and delete it if the submit is clicked. The key is to get the selected
record.

$pass_id should have a date followed by a space followed by a user id. I
parse that in "Change.inc" or "Delete.inc" to break it into the AddDate
value and the user ID value.

Thanks,
Lee

Colin McKinnon
Lee David wrote:

<snip>
QUOTE
<form method="post" action="SQL_Notice.php?act=Change&pass_id="
<input name="postaction" type="hidden" value="selectnotice"
<table align="left"
<tr
<td align="center" width="50%"
<select name="noticechange" size="4"
<option value="2005-06-03 12:06:11Dave"> Dave  2005-06-03 12:06:11
<option value="2005-06-03 03:06:44Dave"> Dave  2005-06-03 03:06:44
<option value="2005-06-03 03:06:18Dave"> Dave  2005-06-03 03:06:18
<option value="2005-06-03 02:06:54Dave"> Dave  2005-06-03 02:06:54
<option value="2005-06-03 02:06:01Dave"> Dave  2005-06-03 02:06:01
</select></td
<td align="right"
<br><br
<input name="submit" type="submit"><br><br></td></tr
</table
</form

The "&pass_id=" should have the value selected, but I'm not sure how to
get
it into there or if that is even the right way to be looking at it.

If I've understood you correctly...

Just print it into the action part - however, since you're using a POST
method to send the remaining data it'd be a lot neater to send this in the
same way:

<form method="post" action="SQL_Notice.php">
<input type='hidden' name='act' value='Change'>
<input type='hidden' name='pass_id' value='<?php
print $_REQUEST['pass_id']; ?>'>
<input name="postaction" type="hidden" value="selectnotice">

Also, you should have '</option>' at the end of each option.

QUOTE

$pass_id should have a date followed by a space followed by a user id.  I
parse that in "Change.inc" or "Delete.inc" to break it into the AddDate
value and the user ID value.

But that's the information that is *returned* in noticechange...it's not
known when you generate the page.

+++Out of cheese error+++
Redo from start

C.


PHP Help | Linux Help | Web Hosting | Reseller Hosting | SSL Hosting
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2006 Invision Power Services, Inc.