y

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

y

Post 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
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post by Unipus »

Uhh... I take it this is reference to something?

Are you capturing your variable after it's sent using _GET?
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

yup

Post 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
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post by Unipus »

Oh. Sounds like you need to put a hidden field in your form with the name/value from imageid.
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

Post by pinehead18 »

What do you mean?
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

Post by pinehead18 »

I actually think i know what your talking about, But, how do i go about that and how doe sit work?
User avatar
lazy_yogi
Forum Contributor
Posts: 243
Joined: Fri Jan 24, 2003 3:27 am

Post 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']
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

Post 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.
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

Post 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
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post 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.
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

Post 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
pinehead18
Forum Contributor
Posts: 329
Joined: Thu Jul 31, 2003 9:20 pm

Post 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
Post Reply