Jump to content

Recommended Posts

I'm stumped, I am no PHP expert instead learning as I go. But I have a problem which I was unable to any answer for in all my net searching.

 

Basically I have a browsing page with a bunch of entries that just shows the title of the entry. Now each title is also a link to a page with more information. To do this I passed the ID of the entry to the url of the next page.

 

Ie

 

moreinfo.php?100 (100 being the id)

 

The on the moreinfo page i use the get command to...get the title and the search the database again for that entry so I can show all the information about that entry.

 

NOW the problem is I decided to create like a favorites thing, similar to ebays watch this item. Now for this I created a new table to store the username and entry ID but when I click the button to submit that. I lose my url and it just reverts to moreinfo.php which as a result clears the other information on the page because there is no ID in the url.

 

How can I submit the form but whilst doing so maintain the url?

 

Any help would be awsome, I don't wanna ditch this function because I couldn't manage to make it.

Link to comment
https://forums.phpfreaks.com/topic/106437-solved-setting-a-title-in-a-form-post/
Share on other sites

not sure i have read this correctly but i think you are saying

you go to a form with some GET's and then submit that form thus lossing the GETs,

 

now you could use sessions or just add some hidden fields into the form

ie

<input name='name' type="hidden" value="<?php echo $_GET['name']; ?>">

yeah i tried a few hidden values but none of them seemed to work

 

basically to give you an idea on the browse page i use this

 

print "<tr><td width=400><a href=\"moreinfo.php?title=$ID\">$Title</a></td><td align=right><a>$converteddate</a></td></tr>";

 

so it passes the id to the url of the next page

 

so it will look like this

 

http://localhost/site/moreinfo.php?title=2

 

but when you click the button to post the data the url reverts to

 

http://localhost/site/moreinfo.php

 

so what i need is for it to post but not change the url or a way to set it back

 

also just fyi, I don't know how to use sessions. Just learning as I go.

 

 

I sort of tried to change things along the lines of what you gave,

 

changed the name to title and set the value to the ID instead of mark as interested (well was trying, didn't quite get it)

 

but I noticed after using the first solution that the information wasn't being entered into the table

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.