PC Nerd
Members-
Posts
1,122 -
Joined
-
Last visited
Never
Everything posted by PC Nerd
-
I Need Help with Dynamically Adding New Form Fields! Please?!
PC Nerd replied to jadeoracle's topic in PHP Coding Help
you coudl do one of two things. you could use PHP as your asking and have the <add more items> button resubmit that page. then what you woudl do is add the values back intot eh field, and echo more fields form your PHP script. Using javascript, you would create new elements in thr form - probably using a name like <*** name = name_1> having "1" increment. then you could easily play with those names on the form handling page. Hope that helps to spell it out a little more. gdlk -
Hi, Ive got the following code, and its meant to display the possilbe days hours and minutes within 2 months, and then place it into a timstamp for storage in the database. Im also looking for a way to get the timestamp and turn it back into the 3 menus, using the <option... selected> values. CREATE THE ARRAYS FOR THE DROP DOWN MENUS $Days = array(); $Hours = array(); $Minutes = array(); for($i=time();$i< strtotime('+2 months');$i += 86400) { $day = date("d/m/y - l", $i); $Days[$i] = $day; } for($i = 0; $i < 24;$i++) { $hour = $i * 60 * 60; $Hours[$i] = $hour; } for ($i = 0; $i < 60; $i++) { $Minutes[$i] = $i*60; } DROP DOWN MENUS Start Date: <select name = 'Start_date_day'><?php foreach($Days as $field => $value) { echo "<option value = '".$field."'>".$value."</option>\n";} ?></select> Hour: <select name = 'Start_date_hour'><?php foreach($Hours as $field => $value) { echo "\t<option value = '".$value."'>".$field."</option>\n";} ?></select> Minutes: <select name = 'Start_date_minute'><?php foreach($Minutes as $field => $value) { echo "\t<option value = '".$value."'>".$field."</option>\n";} ?></select> <br><br> Finish date: <select name = 'Finish_date_day'><?php foreach($Days as $field => $value) { echo "<option value = '".$field."'>".$value."</option>\n";} ?></select> Hour: <select name = 'Finish_date_hour'><?php foreach($Hours as $field => $value) { echo "\t<option value = '".$value."'>".$field."</option>\n";} ?></select> Minutes: <select name = 'Finish_date_minute'><?php foreach($Minutes as $field => $value) { echo "\t<option value = '".$value."'>".$field."</option>\n";} ?></select> <br><br> Can Anyone tell me how i am meant to creat the timestamps form these values? at the moment im simply adding the three values together - ie $days + hours + minutes..... but thats on the form handling page. Thanks, PC_Nerd
-
dates - create an array of dates until 2 months time
PC Nerd replied to PC Nerd's topic in PHP Coding Help
thanks.... is it the same with hours and minutes? and if ive got the days, hours and minutes - how would i place the strings together..... ie if they trhee are seperate? thanks -
if you hav a user ID..... simply take all teh user ID's and place the m in an array and place that array in a cookie or session for tha tuser. then all you do is do pagination with those ID's.... shuffle($IDs); and then work from that. only selecting rows in a given range in teh shuffles ID array/ I know itsmessay with allthe mysql queries.... but its one method. gdlk
-
you dont even need to use the case. $_SESSION[group2'] = $_POST['group2']; just move it directly into the session array *** assumign youve validated all data at he top of the page etc.
-
Thanks firstly -thats the first AJAX tutoriak that has made sense to me. Thanks Although this is really helpful - I still wanted to avoid the use of AJAX altogehter ( as i am not confiden with it for a comercial project) is there another method that uses only PHP? also - how woudl i go abotu the refresh thing with the frame? Thanks
-
Hi, I wanted to create an array that contained every day until 2 months from $now. I then want to place this into a drop down box - which i wont have any trouble with. is there a date function that can do this for me? also - i wanted to create 3 drop down menues, Day, Hour(24), Minute. and from teh data pulled from these create a timestamp value. - I may also want to have 12 horu time with an AM or PM selection as well. How woudl i go about this? i am familiar with teh timestamps and time formatting: from timestamp to text, but i dont know how to go from text to timestamp. Thanks
-
If you wanted to avoid AJAX for the moment, you woudl llload all the images and text into arays within the javascripot. then you woudl use the javascript on teh client to create teh rollover and text change. i think you woudl want to look at "nodes" in javascript - could someoen please confirm this? gdlk
-
Hi, Im looking at building a game where players vs each other, however I wanted it to be live. ie, in real time. My problem is that you cant sync all theplayers to the server etc, meaning that once a page downloads, it wont be receiving data from teh server. I tend to think that th only way around this problem is using somethign like AJAX or JAVA, however ive been told that its possible to do itin PHP. I was wondering how this would be possible? Thanks
-
q = "SELECT * FROM " . Games . " WHERE gName = '$fil' ORDER BY `gName` ASC "; just place it in one line like this ( you also missed a $ i think) $q = "SELECT * FROM ".$Games." WHERE gName = '".$fill."' ORDER BY gName ASC"; Hope that helps
-
[SOLVED] [ ] tags - what on earth does it mean?
PC Nerd replied to PC Nerd's topic in PHP Coding Help
cheers -
ok change your query to: "SELECT * FROM article ORDER BY article_time DESC LIMIT 1" youll have to make sure that your article's table stores when the article was added, and youll have to chek that field name and replace "article_time" with the field name. If you have any nmore problems let us know....
-
Returning to user to their topic after creating it
PC Nerd replied to Eiolon's topic in PHP Coding Help
somehow youll have to create a variabel that stores boolean: reply or new post. once youve validated that its a new post ( no set Topic_ID) - then you add code at the top of the page to where its all sent. that page will submit the post - and retrive the ID back out again. I have to do it for my create user script. eg: NEW POST ==> SUBMIT POST TO DATABASE ==> retreive the ID again ==> WRITE TO SESSION VARIABLE Instead of using a timestamp to get that POST, why dont you use that first 10 characters of the message, because theyll still be stored in $_POST variables on that script? eg $Message $_POST['MESSAGE']; ### WRITE THIS TO DATABASE $SQL = SELECT * FROM POSTS WHERE MESSAGE == ".$Message"; ### RUN ANOTHER QUERY...... and youll have your message data again with the database auto increment values etc. Hope this helps -
ie: $_SESSION['User_Name'] = "PC_Nerd"; echo $_SESSION['User_Name']; the first writes the value to the session variable, the second "reads" it from the variable. hope that helps
-
Hi. Im looking at some code and I came across lines that look like this: show_menu(1,0,1,true,'<li>[a][menu_title][/a]</li>','','','','','class="current"'); now i can tell about the arguments etc, however what is the [a][menu_title][/a] doing - and what language is it? I understand that BBcode can use that sort of thing for forum text stuff - which is also the format that we use here on PHPfreaks. however personally the [menu_title] looks like a variable to me... just in its usage. Can someone let me know if I am thinking correctly that this is a variable? or is there somethign in PHP that ive missed completly? Thanks
-
thanks, all solved.
-
bump what are MIME types etc? im not too familiar with this. all i want this script to do is get the file that it is given, and create a download dialog. I dont want it read in the browser (like pdf etc)....? thanks
-
hmmmmm m not too familiar with mime types etc. what are they? also, ill be downloading about 5 different file types with my script. eould this pose a poblem? tthankx
-
Hi, I know you can force a downlaod dialog with headers.... however a) im not sure how to do it and b) my current code doesnt work. Is this corect, or am i completely on the wrong track....thanks for your help in advance. header("Content-type: application/".$_GET['type'].""); header("Content-Disposition: attachment; ".$_GET['file'].";"); readfile("$_GET['file']");
-
none..... <?php header("Content-type: application/".$_GET['type'].""); header("Content-Disposition: attachment; ".$_GET['file'].";"); #readfile("$_GET['file']"); ?> thats the entire document
-
Hi guys. Ive got the following code. however its telling me to download itself ( download.php), and not the file in the $_GET data... <?php header("Content-type: application/".$_GET['type'].""); header("Content-Disposition: attachment; ".$_GET['file'].";"); readfile("$_GET['file']"); ?> is this the correct code or do i need to try something different? The data type will change. at the moment the data types are as following: .py, .java, .zip, .js( not sure). We may also be downloading .exe etc. *its a programmign website. Thanks
-
thanks. Ill go through those tutorials, and let you knwo how i go
-
Hi, Im looking at creating a playlist program for my server. i have alist of files within my database, and i wanted to be able to place these values into a playlist file. the problem is that i dont know how to get the database to create the playlist form its records. ie, if i uploaded a new file to my server and into the database, then i woudl want the script to automatically grab that file ( SQL i know), anbd the nplace it in the m3u file ( i dont know). Coudl someone recommend a simple method to complete this? or point me in teh righ t doirection for a tutorial? thanks
-
oh yea, like 32 thousand or something my thing is that their all random. so either ive mis understood ports, or my scripts not working properly. the $_SERVER['REMOTE_PORT'] is returning wierd ones. thqanks