School Map:
Home / Enroll
$ Student Records; Class
$ News @ LIVE
Tech Radio * Support/FAQ
| Store | FORUMS
Class / Forums / php101 ![]() |
Week #10 Basic To-Do Assignment, post here |
(#18 2003-08-07 16:56:11) Post Reply |
|
TDavid
|
Week #10 Basic TO-DO ASSIGNMENT: Write a script to add sorted email addresses and names to a file and with the same script how to retrieve all the information and print to browser the name and email address in a table to the browser.
Post this assignment here so that we can offer comment/critique for you, but also post a URL to the working copy of the script and the complete source code of the script in your post. scriptname.php <-- script name Good luck to you!
|
(#266 2003-09-22 07:51:41) Post Reply |
|
Shrek
|
My Week 10 Basic Assignment
http://members.lycos.co.uk/jef...wan/class10.php The delete Switch is just for further purpose. No use now. |
(#342 2003-10-29 16:01:24) Post Reply |
|
Quicksaver
|
In the course text, on the "A form to add to and delete members from the existing file" section, i found this line:
<input type="action" value="delete"> isnt it <input type="hidden" name="action" value="delete"> ? were you in a rush? :) |
(#343 2003-10-29 16:25:29) Post Reply |
|
Quicksaver
|
ok forget what i said, i got tottaly lost with that code:
the form part is tottally wrong i beleive, instead of <input type="action" value="delete"> and <input type="action" value="add"> it should defenetly be: <input type="hidden" name="action" value="delete"> and <input type="hidden" name="action" value="add"> and i was gonna say something about the select dropdown for() loop but i would be dumb cuz its cool :) you could put the explode $file_contents outside the loop tho, if the file is too big it can take a considerable ammount of time to explode as many times as existing names |
(#400 2003-11-23 05:25:24) Post Reply |
|
Quicksaver
|
hi :)
working url ho yeah, since i changed hosts all the previous assignements are located here |
(#754 2004-12-14 11:09:28) Post Reply |
|
lestat
|
I am stuck. I can't get my page to display the data until submit is hit a second time, or the page is refreshed!? * Please help me *
Incidentally, when 'refresh' is hit, the same data is resubmitted. Whats a way around that? Code is not error checked..yet...
Working url: http://tdurl.com/a7 |
(#758 2004-12-15 15:53:04) Post Reply |
|
TDavid
|
Hi Lestat - as I just showed you in the irc.scriptschool.com #scriptschool chat. The $sizeof variable is being assigned a value before you add a new item to it so the for loop isn't reaching the last item in the array (the newest item). |
(#760 2004-12-16 15:07:32) Post Reply |
|
lestat
|
OK got it. Somebody *wink* mentioned to me that my $sizeof count was up in the beggining of the code. This was causing the table to be output from the original data, not the new appended data. Its always something small!
Working url: [url]http://tdurl.com/a7[/url] |
(#843 2005-07-03 05:29:56) Post Reply |
|
vegyta2004
|
MY assignment:
<? if((($_POST["name"]=="")or($_POST["name"]==" "))or(($_POST["e_mail"]=="")or($_POST["e_mail"]==" "))) {echo"You haven't completed the form";} else{ if(ereg("^(.+)@(.+)\\.(.+)$",$_POST["e_mail"])) { $file1=fopen("D:\PROGRAME INSTALATE-FUNCTIONALE\wamp\www\proiecte\assignments\week10\basic\basic.txt","a"); fwrite($file1,$_POST["name"]); fwrite($file1,":"); fwrite($file1,$_POST["e_mail"]); fwrite($file1,"\r\n"); $file1=fopen("D:\PROGRAME INSTALATE-FUNCTIONALE\wamp\www\proiecte\assignments\week10\basic\basic.txt","r"); while(!feof($file1)) {$info[]=fgets($file1);} sort($info); $sizeof=count($file1); foreach($info as $key=>$value){$separator=explode(":",$info[$key]);?> <table width="104" border="1" cellpadding="2" cellspacing="1" bordercolor="#0000FF" bordercolorlight="#3300FF" bgcolor="#ECE9D8"> <td width="65" ><?echo"$separator[0]";?></td> <td width="65"><?echo"$separator[1]";?></td> </table> <? } fclose($file1); } else {echo"Your mail Is Invalid";} } ?> <br><br> <form method="POST"action="<?PHYP_SELF?>"> NAME<input type="text"name="name"><br> E-Mail:<input type="text"name="e_mail"><br> <input type="submit"><br> <input type="reset"> </form> |
(#925 2006-01-03 20:11:58) Post Reply |
|
Dylan
|
Link to my email list script for week 10:
http://www.algore.org/~admin/mailfile.php
And the code: |
(#981 2006-03-23 23:51:13) Post Reply |
|
Russell
|
i thought this was very tough. took me all day to figure out the explode and how to open and write to the files. anyways, here it is
|
|
View Previous Thread Print This Page |
School Map:
Home / Enroll
$ Student Records; Class
$ News @ LIVE
Tech Radio * Support/FAQ
| Store
Advertising
| Link To Us | Privacy
Copyright 2000-2002 Script School Productions / KMR
Enterprises
No part of this website may be reproduced, copied and/or distributed
in any medium
without express written permission