Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Page not refreshing most current data. Help!

Status
Not open for further replies.

Shanksta

Technical User
Joined
Jun 28, 2002
Messages
96
Location
US
Hi

I have 2 pages to help deal with contacts and events.


CONTACT HUB PAGE -
Shows customer info nicely and also a dynamic table of events associated with that customer. The event table has a link at the end to modify that event. It uses a hidden form field that has that specific id...or it should... (SEE BELOW)


EVENT MANAGER PAGE -
This is where you can add an event.
It has an if statement - if it detects an filled post variable ( != '') it queries the database for that event id, fills in the associated form fields for modification, and allows the user to update the field.

If the variable is empty, it shows a form to add a new event with some default values.

To debug I have the form echo the event id it was sent.

Under this form is always an included php file that lists the events with that contact. It is the same file as on the Hub page.


THE PROBLEM:
The form does not update - meaning if a user were to press add event, and then change their mind to modify an event instead by selecting "modify" from the dynamic table, it will not change!

Also, I have seen that the "event id" that is captured for each contact is the same (although in the db it is not), meaning that whether I press the third row modify link or the 1st row modify link the echo is the same - meaning all the rows are given the same event id, though in my table the form is under the while statement per record, so this is a little unclear to me how this happened.


Any help/direction would be appreciated, thanks.
 
It's difficult to say. Is the form in which you can modify an event the same one in which you can add an event?


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Different forms, each within its applicable if statment using INSERT and UPDATE.

I have also echoed the event id before the form in the events table.

What I see is:
3 MODIFY
4 MODIFY
5 MODIFY

But when hover over the link, I have switched to GET to see this, I see that the ?event_id that is given is always the first one, meaning as the while statement works goes through each record it doesn't seem to update this value.
 
THIS IS THE ISSUE:

I have fixed everything after trying a small little change.
The form used to be submitted via:
<a href="" onClick="document.forms[0].submit(); return false;">modify</a>

Now that I change to
<input type="submit" name="modify" value="modify" />
seems to work flawlessly! WHOOPIE!

But... how do I maintain a text link or something similar looking while still having the form work?
 
This may be much more in the JavaScript realm, but...
An <a> tag with an onClick event? Usually the href attribute holds the JavaScript code:
Code:
<a href="javascript:document.forms[0].submit();>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top