Jump to content

jambojim

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

About jambojim

  • Birthday 05/03/1946

Profile Information

  • Gender
    Male
  • Location
    Tuscaloosa, Alabama

jambojim's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Oops! The "yellow" obviously doesn't belong with the "$output..." Next time I'd better "preview." jambojim
  2. Thank you for the quick reply. I have included the PHP code. This code works in conjunction with an HTML file, also. Please let me know if you also need that info. <?php //form code for user information input print "<div align=\"center\">"; print "<p><font size=\"+1\">Database Workshop</font></p>"; print "<table width=\"80%\" border=\"0\">"; print " <tr><td><div align=\"center\">To register for this workshop, please enter your information and click Submit. </div></td></tr>"; print "<tr><td bgcolor=\"#CCCCCC\"><form name=\"form1\" method=\"post\" action=\"workshop.php\">"; print "<table width=\"100%\" border=\"0\">"; print "<tr><td width=\"44%\"><div align=\"right\">Name:</div></td>"; print "<td width=\"56\"><input type=\"text\" name=\"name\"></td></tr>"; print "<tr><td><p align=\"right\">Email Address:</p></td>"; print "<td><input type=\"text\" name=\"email\"></td></tr>"; print "<tr><td><p align=\"right\">Phone Number:</p></td>"; print "<td><input type=\"text\" name=\"phone\"></td></tr>"; print "<tr><td><div align=\"right\">Comments:</div></td>"; print "<td><textarea name=\"comments\" cols=\"30\" rows=\"4\"></textarea></td></tr>"; print "<tr><td colspan=\"2\"><div align=\"center\">"; print "<input type=\"submit\" name=\"Submit\" value=\"Submit\">"; print "<input type=\"reset\" name=\"reset\" value=\"Reset\"></div></td></tr></table></form></td></tr></table><br></font></div>"; //reads counter from "count.dat" file - will need to be preset to number of students in workshop $counter_file="count.dat"; if(!($fp=fopen($counter_file,"r"))) die ("Cannot open $counter_file."); $counter=(int)fread($fp,20); fclose($fp); //emails information to xxxxxxxxx@xxx.edu $to="xxxxxxxxx@xx.edu"; $subject="New Database Workshop Registration"; $body="$comments"; mail($to,$subject,$body); //rolls counter down 1 for display purposes $count=$counter-1; //gets current date ( Month Day Year) $date=gmdate("M d Y"); //assign data file "registrants.txt" $file="registrants.txt"; //if the remaining student counter is above 0, writes registrant info to file formatted for html if($counter!=0) { $fp=fopen($file,"a+"); fwrite($fp,"<div align=\"center\"><table width=\"70%\"><tr><td><hr noshade width=\"60%\"><h3>Registrant #$counter</h3><br><b>Date: </b>$date \n<br><b>Name: </b>$name \n<br> Phone: $phone \n<br> <b>Email: </b><a href=\"mailto:$email\">$email</a> \n<br><br><b>Comments:</b>$comments</font>\n\n<br><hr noshade width=\"60%\"></td></tr></table></div>"); //if there are more than 2 positions left, thanks registrant for registering if($counter>2) print "<div align=\"center\"><h2>Thank you for registering, there are $count positions left.</h2></div>"; //if there is only one position left, thanks registrant for registering elseif($counter==2) print "<div align=\"center\"><h2>Thank you for registering, there is $count position left.</h2></div>"; //if there are no positions left, thanks registrant for registering elseif($counter==1) print "<div align=\"center\"><h2>Thank you for registering, there are no available positions left.</h2></div>"; fclose($fp); } //if there are no positions left when submit is clicked, user is notified else print "<div align=\"center\"><h2>This workshop is completely full.<br>Please register for another workshop in the future.</h2></div>"; //rolls counter down 1, and writes the new value to the "count.dat" file if($counter>0) $counter--; else $counter=0; $fp=fopen($counter_file,"w"); fwrite($fp,$counter); fclose($fp); //outputs the contents of the file to the screen $output=readfile($file); ?> jambojim
  3. I am currently editing a PHP script I located on the internet. I have created a multi-line file that inputs to the screen. I am using the following command: $output=readfile($file); The command works just fine. My problem is I don't want all of the information within the file to display. Two of the lines of information are a phone number (phone) and an email address (email). How do I go about suppressing the phone and email information so it remains in the file, but does not display on the screen? Thank you for any assistance you may provide. jambojim
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.