SitePoint Sponsor

User Tag List

Page 2 of 3 FirstFirst 123 LastLast
Results 26 to 50 of 51
  1. #26
    SitePoint Guru themightystephen's Avatar
    Join Date
    Mar 2005
    Location
    England
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So if you revert back to the original code without:

    if (isset(urlencode($_GET['rideid']))) {
    $rideid=urlencode($_GET['rideid']);

    and using the code that was there before, do you still have problems with it working?

    About your image question, I suggest having a quick search through the PHP forums as there are quite a lot of threads about displaying images through storing the locations in a database.
    Get your heelys now at flywalk.co.uk - But what are heelys?
    Heelys are simply shoes with wheels in the heels!

    Flywalk.co.uk - The UK Heelys Retailer

  2. #27
    SitePoint Guru themightystephen's Avatar
    Join Date
    Mar 2005
    Location
    England
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Does your database have a simple id field that is the primary key and is auto incrementing? I ask because I am confused about why rideid=%2F%221%2F%22 is passed to the address bar rather than rideid=1 or whatever the id is i.e. 2, 3 etc.

    I don't know because I'm not an expert but I'm wondering if it is a setting on the server your on which is causing the variable being passed through the address bar to be changed in that strange way.
    Get your heelys now at flywalk.co.uk - But what are heelys?
    Heelys are simply shoes with wheels in the heels!

    Flywalk.co.uk - The UK Heelys Retailer

  3. #28
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have tried using the original two lines and it does not work and it is passing http://www.atmania.com/parkride.php?...=%2F%223%2F%22 istead of 1,2 or 3

    Yes the database is correct.

    Thanks

    Neil

  4. #29
    SitePoint Guru themightystephen's Avatar
    Join Date
    Mar 2005
    Location
    England
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'll look around and see if I can find a solution.

    I think I'll start a new topic and see if anyone helps me out.
    Get your heelys now at flywalk.co.uk - But what are heelys?
    Heelys are simply shoes with wheels in the heels!

    Flywalk.co.uk - The UK Heelys Retailer

  5. #30
    SitePoint Guru themightystephen's Avatar
    Join Date
    Mar 2005
    Location
    England
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi again,

    Someone showed me the tiny mistake I made in my code that is causing the problem.

    In themepark.php look for:
    echo '<option value=/"'.$rideid.'/">'.$row['ridename'].'</option>';

    and change it for this:
    echo '<option value="' . $rideid . '">' . $row['ridename'] . '</option>';

    It should then work!
    Get your heelys now at flywalk.co.uk - But what are heelys?
    Heelys are simply shoes with wheels in the heels!

    Flywalk.co.uk - The UK Heelys Retailer

  6. #31
    SitePoint Guru themightystephen's Avatar
    Join Date
    Mar 2005
    Location
    England
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    With the problem you mentioned earlier about getting the image to actually appear you just need to put image tags around the right bits so that the path to the image is correct.

    PHP Code:
    // Start displaying data by using $getridedata array and change the field names to whatever your fields are 
    echo '<b>Ride Name</b>: <br /><img src="'.$getridedata['ridename'].'" /><br />'
    echo 
    '<b>Ride Description</b>: '.$getridedata['description'].'<br />'
    echo 
    '<b>Ride Duration</b>: '.$getridedata['rideduration'].'<p></p>'
    echo 
    '<b>Whatever field you want here</b>: '.$getridedata['blablabla'].'<p></p>'
    You may have to adjust it for it to work.
    Get your heelys now at flywalk.co.uk - But what are heelys?
    Heelys are simply shoes with wheels in the heels!

    Flywalk.co.uk - The UK Heelys Retailer

  7. #32
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey,
    Thanks so much. I ahve been looking around for ways to put image paths into a table and i have found just to ut the path in the table but when i view it, it just writes the path ut and doesn't change it to be the image

  8. #33
    SitePoint Guru themightystephen's Avatar
    Join Date
    Mar 2005
    Location
    England
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Could you show me exactly what you mean on the website you have?

    and also, have you tried what I said above about images?
    Get your heelys now at flywalk.co.uk - But what are heelys?
    Heelys are simply shoes with wheels in the heels!

    Flywalk.co.uk - The UK Heelys Retailer

  9. #34
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry i didn't see the post above, trying it now!

    Cheers

  10. #35
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey,
    Check the page www.atmania.com/themepark.php

    I have done little modification and thats the result.

    I can now with all your help try to make a new table and write new pages to implement all this new stuff into my current site! Wahey!

    Thanks so much!

    Neil

  11. #36
    SitePoint Guru themightystephen's Avatar
    Join Date
    Mar 2005
    Location
    England
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Woohoo! I know the feeling, it's very satisfying getting something working after hours of work! lol.
    Get your heelys now at flywalk.co.uk - But what are heelys?
    Heelys are simply shoes with wheels in the heels!

    Flywalk.co.uk - The UK Heelys Retailer

  12. #37
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Once i have fully implemented it and it is working with more fields and stuff i shall post here to show you. I will also need help making a ride review system where the rideid passed from the drop down box makes sure only reviews about that ride are shown on the page. I shall try it myself first!

    Thanks

    Neil

  13. #38
    SitePoint Guru themightystephen's Avatar
    Join Date
    Mar 2005
    Location
    England
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    By the way, if I were you I would go through the code and really try to understand it because once you do you'll really start to grasp PHP and get the hang of how you can use it.
    Get your heelys now at flywalk.co.uk - But what are heelys?
    Heelys are simply shoes with wheels in the heels!

    Flywalk.co.uk - The UK Heelys Retailer

  14. #39
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    Yeh, i am learning it via trying to make things like this work. I ahve tried implementing all this into my main site and i have made a new table and set all the details and i get this error:

    Parse error: parse error, unexpected $end in c:\Sites\Single19\rctneil\webroot\future\ride.php on line 192

    Heres the code for the ride.php page minus the log in details:

    ride.php:
    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    <html>
    <head>
    <link rel="shortcut icon" href="http://www.atmania.com/atm.ico">
        <title>::Alton Towers Mania:: - NAME OF RIDE</title>
        <link rel=stylesheet type="text/css" href="style.css">
        <style type="text/css">
    <!--
    .style3 {font-size: 12px; font-weight: bold; }
    .style5 {font-size: 12px}
    -->
        </style>
    </head>

    <body background="img/background.jpg" bottommargin="0" leftmargin="0" marginheight="0" marginwidth="0" rightmargin="0" topmargin="0">
    <bgsound src="page sounds/swsound.wav" loop="1">
    <?php 
    // connect to mysql 
    $dbcnx mysql_connect("xxxx""xxxx""xxxx"
           or die(
    mysql_error()); 

    // select db 
    $db mysql_select_db("rctneil"
          or die(
    mysql_error()); 

    // check to see if the ride id has been passed through the address bar 
    // if it has then assign the variable $rideid to that value from the $_GET array 
    if (isset($_GET['rideid'])) { 
    $rideid=$_GET['rideid']; 

    // get info from database so that it can be displayed on the page later 
    // remember the id has been passed through the address bar so now the query just uses that id's record of data 
    $sql=@mysql_query("SELECT*FROM atm_rides WHERE id='$rideid'"); 
    // mysql_fetch_array is an array which holds all the records field values, assign $getdata variable to this array 
    $getridedata=@mysql_fetch_array($sql); 

    // Start displaying data by using $getridedata array and change the field names to whatever your fields are

    ?>

    <center><table width="765" height="100%" cellpadding="0" cellspacing="0" border="0" background="img/mainbackground.jpg"><tr valign="top"><td><table width="764" height="42" border="0" cellpadding="0" cellspacing="0" background="img/left1bg.jpg">
        <tr valign="top">
          <td width="113" background="img/toplogobg.jpg"><img src="img/blanklogo_topoflogo.jpg" width="248" height="97"></td>
          <td width="651" background="img/toplogobg.jpg"><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td><div align="center">
              <?php
    include "header.php";
    ?></div></td>
            </tr>
          </table></td>
        </tr>
        <tr valign="top">
    <td colspan="2" background="img/left1bg.jpg"><img src="img/left1_bottomoflogo2.jpg" width="169" height="42"></td>
    </tr>
    </table>

    <table width="764" height="506" border="0" cellpadding="0" cellspacing="0">
        <tr valign="top">

          <td width="150" height="324"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td><?php
    include "nav.php";
    ?></td>
            </tr>
          </table>
            <!-- menu below, copy and paste the menudivider.jpg code as necessary -->
              <!-- the &nbsp; is code for a one letter space -->
            <!-- end menu --></td>
          <td width="9">&nbsp;</td>
    <td width="596">

    <p>
      <!-- add your content below -->
    </p>
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td><div align="center"><?php echo '<img src="'.$getridedata['titleimage'].'"/>' ;?></div></td>
      </tr>
    </table>
    <p align="justify"><img src="page headings/review.jpg" alt="Ride Review:" width="151" height="22"><BR>
      Spinball Whizzer is 2004's new family ride. It is one of two Mourer Sohne   spinning coasters for the Tussauds parks. It whizzes and spins it's way around   adventure land twisting any way it likes. You'd be flippin crazy to miss it.
      <!--end description-->
      <BR>
    </p>
    <p><img src="page headings/statistics.jpg" alt="Ride Statistics:" width="201" height="22"></p>
    <table border="1" align="center" cellpadding="0" cellspacing="0" width="70%"center">
      <tr>
        <th><div align="center" class="style3">
          <div align="right">Manufacturer </div>
        </div></th>
        <td><div align="center">Maurer Sohne </div></td>
      </tr>
      <tr>
        <th><div align="right"><span class="style5">Type</span></div></th>
        <td><div align="center">Xtended SC 3000 </div></td>
      </tr>
      <tr>
        <th><div align="center" class="style3">
          <div align="right">Location </div>
        </div></th>
        <td><div align="center">Adventure Land </div></td>
      </tr>
      <tr>
        <th><div align="center" class="style3">
          <div align="right">Cost </div>
        </div></th>
        <td><div align="center">&pound;3.5 Million </div></td>
      </tr>
      <tr>
        <th><div align="center" class="style3">
          <div align="right">Track Length </div>
        </div></th>
        <td><div align="center">470 Metres </div></td>
      </tr>
      <tr>
        <th><div align="center" class="style3">
          <div align="right">Installed </div>
        </div></th>
        <td><div align="center">2004</div></td>
      </tr>
      <tr>
        <th><div align="center" class="style3">
          <div align="right">Height of drop </div>
        </div></th>
        <td><div align="center">17 Metres </div></td>
      </tr>
      <tr>
        <th><div align="center" class="style3">
          <div align="right">Train Capacity </div>
        </div></th>
        <td><div align="center">32</div></td>
      </tr>
      <tr>
        <th><div align="center" class="style3">
          <div align="right">Trains </div>
        </div></th>
        <td><div align="center">8, 2 rows, 2 per row </div></td>
      </tr>
      <tr>
        <th><div align="center" class="style3">
          <div align="right">On Ride Photography </div>
        </div></th>
        <td><div align="center">Yes </div></td>
      </tr>
    </table>
    <p><BR>
      <img src="page headings/gallery.jpg" alt="Ride Gallery:" width="173" height="22"></p>
    <p align="center"><a href="http://www.atmania.com/coppermine/thumbnails.php?album=18">OPEN SPINBALL WHIZZER GALLERY</a> </p>
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><div align="center">
          <?php
    include "footer.php";
    ?>
        </div></td>
      </tr>
    </table>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p>
    <p align="justify">&nbsp;</p></td>
    <td width="8">&nbsp;</td>
        </tr>
    </table>
    </td></tr></table></center>
    </body>
    </html>

  15. #40
    SitePoint Guru themightystephen's Avatar
    Join Date
    Mar 2005
    Location
    England
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't think that this part has an ending }. You may need to add that right at the end or wherever the appropriate place is.

    PHP Code:
    if (isset($_GET['rideid'])) { 
    $rideid=$_GET['rideid']; 
    You would want it here I'd imagine:

    PHP Code:
    </table> 
    </td></tr></table></center>
    <?php
    }
    ?>
    Get your heelys now at flywalk.co.uk - But what are heelys?
    Heelys are simply shoes with wheels in the heels!

    Flywalk.co.uk - The UK Heelys Retailer

  16. #41
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can i put code in the title tag of the page to get it to get the ridename from the db table and put it in the pages title? If so can i leave the db connection details in the body or do they need to be above the title tag?

    Thanks

    Neil

  17. #42
    SitePoint Guru themightystephen's Avatar
    Join Date
    Mar 2005
    Location
    England
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm pretty sure you would need them above. All you would need to do is GET the ridename and echo it in the title tag just like how you would display db data anywhere else on the page.
    Get your heelys now at flywalk.co.uk - But what are heelys?
    Heelys are simply shoes with wheels in the heels!

    Flywalk.co.uk - The UK Heelys Retailer

  18. #43
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Like this?

    PHP Code:
    <?php echo .$getridedata['ridename'].; ?>
    As that doesn't work even below the connection

    Can you put php code in the between <head> and </head>?

    Thanks

    Neil

  19. #44
    SitePoint Guru themightystephen's Avatar
    Join Date
    Mar 2005
    Location
    England
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah but remember you will need to set the $getridedata variable before the title as well. So just move that up after the db connection.

    And yes, theres nothing wrong with putting php code in the head.
    Get your heelys now at flywalk.co.uk - But what are heelys?
    Heelys are simply shoes with wheels in the heels!

    Flywalk.co.uk - The UK Heelys Retailer

  20. #45
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have tried quite a few things and lots have worked. i can now add rides via a website form and view a list of all rides in the table. But i have modified the code from the editauthors.php page which was an example in the siepoint book and changed it to my needs. The id is passed thorugh the link from rides.php and i can see the form but the text boxes are not being filled in automatically so they can be changed?

    Here is the code for the new editrides.php

    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>ATM Ride CMS: Edit Ride</title>
    <meta http-equiv="content-type"
        content="text/html; charset=iso-8859-1" />
    </head>
    <body>
    <?php

    // connect to mysql 
    $dbcnx mysql_connect("-----""-----""-----"
           or die(
    mysql_error()); 

    // select db 
    $db mysql_select_db("rctneil"
          or die(
    mysql_error()); 

    if (isset(
    $_POST['name'])):
      
    // The ride's details have been updated.

      
    $ridename $_POST['ridename'];
      
    $titleimage $_POST['titleimage'];
      
    $pagesound $_POST['pagesound'];
      
    $ridereview $_POST['ridereview'];
      
    $id $_POST['id'];
      
    $sql "UPDATE atm_rides SET
          ridename='
    $ridename',
          titleimage='
    $titleimage',
          pagesound='
    $pagesound',
          ridereview='
    $ridereview'
              WHERE id='
    $id'";
      if (@
    mysql_query($sql)) {
        echo 
    '<p>Ride details updated.</p>';
      } else {
        echo 
    '<p>Error updating ride details: ' .
            
    mysql_error() . '</p>';
      }

    ?>

    <!--p><a href="authors.php">Return to authors list</a></p-->

    <?php
    else: // Allow the user to edit the ride

      
    $id $_GET['id'];
      
    $ride = @mysql_query(
          
    "SELECT ridename, titleimage, pagesound, ridereview FROM atm_rides WHERE id='$id'");
      if (!
    $ride) {
        exit(
    '<p>Error fetching ride details: ' .
            
    mysql_error() . '</p>');
      }

      
    $author mysql_fetch_array($ride);

      
    $ridename $ride['ridename'];
      
    $titleimage $ride['titleimage'];
      
    $pagesound $ride['pagesound'];
      
    $ridereview $ride['ridereview'];

      
    // Convert special characters for safe use
      // as HTML attributes.
      
    $ridename htmlspecialchars($ridename);
      
    $titleimage htmlspecialchars($titleimage);
      
    $pagesound htmlspecialchars($pagesound);
      
    $ridereview htmlspecialchars($ridereview);

    ?>

    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    <p>Edit the ride:</p>
    <label>Ride Name: <input type="text" name="ridename" value="<?php echo $ridename?>" /></label><br />
    <label>Title Image Path: <input type="text" name="titleimage" value="<?php echo $titleimage?>" /></label><br />
    <label>Page Sound Path: <input type="text" name="pagesound" value="<?php echo $pagesound?>" /></label><br />
    <label>Ride Review: 
    <textarea name="ridereview" cols="40" rows="10"><?php echo $ridereview?></textarea>
    </label>
    <br />
    <input type="hidden" name="id" value="<?php echo $id?>" />
    <input type="submit" value="SUBMIT" /></p>
    </form>

    <?php endif; ?>

    Thanks

    Neil

  21. #46
    SitePoint Guru themightystephen's Avatar
    Join Date
    Mar 2005
    Location
    England
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You have a little mistake here:

    PHP Code:
      $author mysql_fetch_array($ride); 
    Are you sure it should be authors?
    Get your heelys now at flywalk.co.uk - But what are heelys?
    Heelys are simply shoes with wheels in the heels!

    Flywalk.co.uk - The UK Heelys Retailer

  22. #47
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ah, i see. I have started a new thread about this problem but i can continue in here. QWhen i get home from college i will try changing that nad testing it again!

    Thanks

    Neil

  23. #48
    SitePoint Guru themightystephen's Avatar
    Join Date
    Mar 2005
    Location
    England
    Posts
    608
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You mean to say its not the Easter Holidays for you!
    Get your heelys now at flywalk.co.uk - But what are heelys?
    Heelys are simply shoes with wheels in the heels!

    Flywalk.co.uk - The UK Heelys Retailer

  24. #49
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yep, still not the holidays for me yet! Starts at 5:15 this afternoon when i get the bus home and i can test the modified code at 6:25 when i get home *sigh*. I will then have two whole weeks of easter holiday to look forward to and the first week taken up with a trip to Spain and second week full of college assignments *wahey!"

    Thanks

    Neil

  25. #50
    SitePoint Wizard rctneil's Avatar
    Join Date
    Jun 2005
    Posts
    1,890
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    I have managed to download the editrides.php age at college, change it and reupload it and now when i click the edit link next to the name of a ride the editrides.php page loads with the boxes filled in and i cna edit the text. The problem occurs when I click submit i get this error and i cannot see anything wrong on line 48. the error and updated editrides.php code is shown below:

    Error after pressing submit:
    Notice: Undefined index: id in c:\Sites\Single19\rctneil\webroot\future\editride.php on line 48

    Updated editrides.php:
    PHP Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>ATM Ride CMS: Edit Ride</title>
    <meta http-equiv="content-type"
        content="text/html; charset=iso-8859-1" />
    </head>
    <body>
    <?php

    // connect to mysql 
    $dbcnx mysql_connect("-----""-----""-----"
           or die(
    mysql_error()); 

    // select db 
    $db mysql_select_db("rctneil"
          or die(
    mysql_error()); 

    if (isset(
    $_POST['name'])):
      
    // The ride's details have been updated.

      
    $ridename $_POST['ridename'];
      
    $titleimage $_POST['titleimage'];
      
    $pagesound $_POST['pagesound'];
      
    $ridereview $_POST['ridereview'];
      
    $id $_POST['id'];
      
    $sql "UPDATE atm_rides SET
          ridename='
    $ridename',
          titleimage='
    $titleimage',
          pagesound='
    $pagesound',
          ridereview='
    $ridereview'
              WHERE id='
    $id'";
      if (@
    mysql_query($sql)) {
        echo 
    '<p>Ride details updated.</p>';
      } else {
        echo 
    '<p>Error updating ride details: ' .
            
    mysql_error() . '</p>';
      }

    ?>

    <p><a href="rides.php">Return to rides list</a></p>

    <?php
    else: // Allow the user to edit the ride

      
    $id $_GET['id'];
      
    $ride = @mysql_query(
          
    "SELECT ridename, titleimage, pagesound, ridereview FROM atm_rides WHERE id='$id'");
      if (!
    $ride) {
        exit(
    '<p>Error fetching ride details: ' .
            
    mysql_error() . '</p>');
      }

      
    $ride mysql_fetch_array($ride);

      
    $ridename $ride['ridename'];
      
    $titleimage $ride['titleimage'];
      
    $pagesound $ride['pagesound'];
      
    $ridereview $ride['ridereview'];

      
    // Convert special characters for safe use
      // as HTML attributes.
      
    $ridename htmlspecialchars($ridename);
      
    $titleimage htmlspecialchars($titleimage);
      
    $pagesound htmlspecialchars($pagesound);
      
    $ridereview htmlspecialchars($ridereview);

    ?>

    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
    <p>Edit the ride:</p>
    <label>Ride Name: <input type="text" name="ridename" value="<?php echo $ridename?>" /></label><br />
    <label>Title Image Path: <input type="text" name="titleimage" value="<?php echo $titleimage?>" /></label><br />
    <label>Page Sound Path: <input type="text" name="pagesound" value="<?php echo $pagesound?>" /></label><br />
    <label>Ride Review: <input type="text" name="ridereview" value="<?php echo $ridereview?>" /></label><br />
    <input type="hidden" name="id" value="<?php echo $id?>" />
    <input type="submit" value="SUBMIT" /></p>
    </form>

    <?php endif; ?>

    </body>
    </html>
    Thanks

    Neil


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •