Jump to content

zephyrstudios

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

zephyrstudios's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hello all, I am trying to place some html tags within my php script. When I do-I wrap with a <p> tag</p> , but then I am unable to validate the script. I have tried the tags outside the php and in the php and can't figure it out. Any help is appreciated. Here is the script: <?php // Script 5.0000 - age.php $string_story= "In the matter of prolonging human life, science has played no part whatever. Take the case history of one Bessie Singletree. At the early age of five, Bessie suddenly became six and entered school. On trolley cars her age remained at six until she was nine. When she was 11 years old, she was 12, and for the benefit of movies and railroads, she was 12 until she was 15. On her 27th birthday Miss Singletree became 24. At 40 she was 39 and remained so until she was close to 50. At 50 Bessie was 40; at 60, 55. On her 70th birthday everyone said Grandmother Singletree was pretty chipper for an octogenarian. At 75 she had her picture in the paper as the oldest woman in the county, aged 93. Ten years later she passed away at the ripe old age of 109.<br />"; $sub="At the early age of five, Bessie suddenly became six and entered school. On trolley cars her age remained at six until she was nine. When she was 11 years old, she was 12, and for the benefit of movies and railroads, she was 12 until she was 15. On her 27th birthday Miss Singletree became 24. At 40 she was 39 and remained so until she was close to 50. At 50 Bessie was 40; at 60, 55.<br />"; print ("$string_story <br />"); print strlen ("$string_story <br />" );//print length of string print (" <br /> $sub <br />");//print substring print str_word_count ("<br /> $sub <br />");//print length of substring print $sub=ucwords ("<br />$sub <br />");//print string with capitol letters print $sub=strpos ("she", $sub); print $sub=str_replace ('She', 'she', $sub); print $sub=str_replace ('Was', 'was', $sub); ?> </p> In future please use the code ( ) tags when including code in posts. Thank you - wildteen88
  2. I am sorry.... I got it. I found a mistake in my code that I had changed during a test. Thank you very much for your help. I am so excited I was able to get this to work with a lot of help from this forum!!!!!! Thank you for having a place like this. Anne
  3. I am sorry I can't figure this out.....frustrating!!  I tried what you had and know only the last name shows up, I even took the dollar sign out from the fname and still ony the last name works.  Anymore help is greatly appreciated. Thank you Anne
  4. That helped alot!!! :)    This is what worked: '.($_POST['fname']).' But now I am trying to add their last name.  I have tried '.($_POST['fname']['lname']).'  '.($_POST['fname']).' '.($_POST['lname'].' I keep getting errors. i am looking in alot of books trying to solve this and I am sure it is very simple-just not simple to a newbie.  Thanks again in advance for your time and patience. Anne
  5. Thank you for helping me-I am only seeing that you added the {$fname} {$lname} and that did not work-is there something else I am missing??? Thank you in advance for your time and patience. Anne
  6. Hello, I am trying to create a quick little registration page-trying to learn php. I have the form created and get the response-but now I am trying to get the registrars name back in the return statement and am unable to figure out the code to do that. Any help is appreciated. Thank you Anne <?php // register.php //This script registers a user by storing their information in a text file and creating a directory for them. if(isset ($_POST['submit'])){//Handle form $problem = FALSE; //No problems so far //Check for each value. if (empty ($_POST['fname'])) { $problem = TRUE; print '<p>Please enter a first name!</p>'; } if (empty ($_POST['lname'])) { $problem = TRUE; print '<p>Please enter a last name!</p>'; } if (!$problem) { if ($fp = fopen ('./users.txt', 'ab')) {//Open the file //Create the data to be written $dir = time() . rand (0, 4596); $data = $_POST['fname'] . "\t" . $data = $_POST['lname'] . "\t" . $data = $_POST['address'] . "\t" . $dir ."\r\n"; //Write the data and close the file fwrite ($fp, $data); fclose ($fp); //create the directory mkdir ("./users/$dir"); //Print a message print '<p>Congratulations  $fname $lname!  /></p>'; } else {//Couldn't write to the file print '<p>You could not be registered due to a system error.</p>'; } } else {//Forgot a field print '<p> Please try again!</p>'; } } else {//Display again //Leave PHP and display the form ?> <form action="register.php" method="post"> <br /> <table width="100%"  border="0">   <tr>     <th width="11%" scope="col"><div align="left"><strong>First Name: </strong></div></th>     <th width="81%" scope="col"><div align="left">       <input type="text" name = "fname" size="25" />       </div></th>     <th width="4%" scope="col">&nbsp;</th>     <th width="4%" scope="col">&nbsp;</th>   </tr>   <tr>     <td><div align="left"><strong>Last Name: </strong></div></td>     <td><div align="left">       <input type="text" name="lname" size="25" />     </div></td>     <td>&nbsp;</td>     <td>&nbsp;</td>   </tr>   <tr>     <td><div align="left"><strong>Address: </strong></div></td>     <td><div align="left">       <input type="text" name="address" size="35"/>     </div></td>     <td>&nbsp;</td>     <td>&nbsp;</td>   </tr>   <tr>     <td><strong>City:</strong></td>     <td><input type="text" name="city" size="35"/></td>     <td>&nbsp;</td>     <td>&nbsp;</td>   </tr>   </table> <br /> <br /> <input type="submit" name="submit" value="Register" /> </form> <?php
×
×
  • 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.