Page 1 of 1
y
Posted: Tue Jan 13, 2004 8:34 pm
by pinehead18
[Admin Edit: Topic continued from viewtopic.php?t=16653]
Well I did attempet to pass the var through the url. However it makes it to the upload page but when i go to upload it looses the var. Which is my main problem.
It uploads the file to a dir and then updates the db to the file name. But like is aid, it has no idea what to update cuase it looses the var.
I had wanted to also code it to check and see if pic2 had an image if not then upload to that sql db.
Any other questions? Someone had suggested using an array buti'm not sure how to go about that
Posted: Tue Jan 13, 2004 8:42 pm
by Unipus
Uhh... I take it this is reference to something?
Are you capturing your variable after it's sent using _GET?
yup
Posted: Tue Jan 13, 2004 8:44 pm
by pinehead18
Yes, here is basically how it works
my_pictures.php has a list of the pictures and it shows each one. When you click on it. It takes you to the upload page so you can upload or delete the image. The link of the image on my_pictures.php is url/uploadpage.php?imageid=main (or pic1 or pic2 for the other pics and so on)
When it gets to uploadpage.php it reads main. By usgin $_GET. However, once i select an image and hit upload. the form calls uploadpage.php again to run the script and at that time it looses imageid and it has no idea where to upload it.
Thats my main problem
Posted: Tue Jan 13, 2004 8:56 pm
by Unipus
Oh. Sounds like you need to put a hidden field in your form with the name/value from imageid.
Posted: Tue Jan 13, 2004 11:30 pm
by pinehead18
What do you mean?
Posted: Tue Jan 13, 2004 11:30 pm
by pinehead18
I actually think i know what your talking about, But, how do i go about that and how doe sit work?
Posted: Wed Jan 14, 2004 12:22 am
by lazy_yogi
<form action='uploadpage.php' method=post>
<input type=hidden name=keepmyvar value=<? echo $_GET['main']>
... rest of upload form
</form>
then on ur next page that does the upload processing you can get the value vrom
$_POST[keepmyvar']
Posted: Wed Jan 14, 2004 1:41 am
by pinehead18
Thats just tricky enough it might work. Wow, you dont' know how long i've been pulling my hair out over this. Thank you so much. I'll give it a shot in the morning and let you know how it goes.
Posted: Wed Jan 14, 2004 10:55 am
by pinehead18
Ok, i'm sorry to bother you again. In attempts to do this I have come up with a simple question. On what page do i put that input? I belive it is on the uploadimage.php page before it refreshes the page. But, i wanted to double check first.
Thank you again
Posted: Wed Jan 14, 2004 2:46 pm
by Unipus
You have a form on your upload page that handles the... well, the upload, right? Add the hidden field(s) with whatever data you want to carry over to that form.
Posted: Sat Jan 17, 2004 12:56 am
by pinehead18
Ok, i've just been able to start work on this, and i'm sorry for all the dumb questions first time i have ever done a script this extensive before.
This is how i have it set right now..
my_picstures.php - Click on the picture you want to change. This link will take you to edit_pics.php?imageid=pic id you clicked on
the pic id will determine what field to update in the sql for the pic url.
So on edit_pics.php - I have my form wich you select your file and click on submit. But part of that form is a hidden input which is <input type=hidden name=keepmyvar value=<? echo $_GET['pic'] ?>>
- I click on upload file and it reloads edit_pics.php (the form action was set to edit_pics.php) and in order to grab the pic id and keep it i do $_POST['keepmyvar']; and it should echo my pic id correct?
Reason i ask is cuase i'm having issues with it. It is breaking on the last stage.
Thank you for your time and help
Anthony
Posted: Sat Jan 17, 2004 1:00 am
by pinehead18
ummm my apologies. I guess when i call the keepmyvar var. I shoudl actualyl name it keep my var and not get my var

I swear i need more sleep
It works!!! Thank you so much. This helps me big time.
- Anthony