passing url variable and mkdir

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
beermaker74
Forum Newbie
Posts: 6
Joined: Fri Sep 22, 2006 11:55 am

passing url variable and mkdir

Post by beermaker74 »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


ok i have a multi part problem. first off I have a insert record page where a user inserts user name, pass ,and a bunch of other info. that info is inserted into table A. then it takes them to the redirect page. Here is where all the questions start. What I want to do is have a url id passed so i can have access to all the data from table A. On page 2 I have another insert record behavior where i am inserting info about photos into table b. I want table b to be passed the id from the previous page so i can keep track of what photos go with what record. I have a hidden field that would insert this if i could get the url id passed. I am allowing users to upload photos and write descriptions about the photos on the second page. I also want a new folder created in the photo upload dir that is named from the data in table a. ie username and id. so what i was thinking was to pass the url id. then use a recordset to insert the information dynamically. i was using the mkdir command here is my code

Code: Select all

<?php
mkdir("/home/immersiv/public_html/holland/admin/$row_Recordset1['id']", 0777);
?>
here is the error i get when i try this

Code: Select all

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/immersiv/public_html/holland/admin/edit.php on line 209
if i take out the variable and insert a regular name it works fine. ie

Code: Select all

mkdir("/home/immersiv/public_html/holland/admin/newtestdir", 0777);
i am using sephiroth php upload dreamweaver extension to allow users to upload photos. So i want to dynamically assign the folder upload path to the same one that was just created with mkdir. ie

Code: Select all

define("DESTINATION_FOLDER", "/home/immersiv/public_html/$row_Recordset1['id']/");
am i going to have the same problem that i am having with the mkdir function?

If i am going about this totally wrong then please let me know. Do I just need to declare a variable above the mkdir script?
thanks


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

"/home/immersiv/public_html/holland/admin/$row_Recordset1['id']"
to

Code: Select all

"/home/immersiv/public_html/holland/admin/{$row_Recordset1['id']}"
or

Code: Select all

"/home/immersiv/public_html/holland/admin/$row_Recordset1[id]"
or

Code: Select all

'/home/immersiv/public_html/holland/admin/' . $row_Recordset1['id']
I prefer the last one.
beermaker74
Forum Newbie
Posts: 6
Joined: Fri Sep 22, 2006 11:55 am

Post by beermaker74 »

thanks that works but how do i pass the url variable from page 1. plus when i create the folder it wont let me delete it. I have tried umask and creating it thru ftp. All give me the same result. No permission and it is chmod to 755 instead of 777. Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

There are many ways of passing information between pages, but only a few are not possible for the user to directly manipulate. Sessions are one of the few that aren't directly controlled by the user. If you do not wish the user to be able to alter the data, sessions are one to research.
Post Reply