[solved] two questions, pretty simple

  • Nem
  • Guru
  • Guru
  • Nem
  • Posts: 1243
  • Loc: UK

Post 3+ Months Ago

hi,

1) im using the following script on my register page:

PHP Code: [ Select ]
 
<?php
 
include("http://www.69kilobytes.co.uk/header.php");
 
$action = (empty($_GET['a']))? "" : $_GET['a'];
 
if ($action == "add") {
 
    include("connect.php");
 
    $sql = "INSERT INTO members(username, password, email, name, age, weopon, map, quote, image)
 
       VALUES ('$user', '$pass','$email','$name', '$age', '$weopon', '$map','$quote','$image')";
 
    $query = mysql_query($sql) or die("Cannot query the database.<br>" . mysql_error());
 
 
 
    $output =  '<br><table width="90%" height="240" border="0" align="center" cellpadding="0" cellspacing="0">
 
 <tr>
 
   You have been added successfully.<br>
 
   <a href="http://www.69kilobytes.co.uk/cp/admin.php">Back to Admin CP</a>
 
 </tr>
 
 </table>';
 
}else{
 
$output = '<table width="90%" height="240" border="0" align="center" cellpadding="0" cellspacing="0">
 
 <tr>
 
   <td height="20" colspan="2">
 
     <h3 align="center">please fill in below - you
 
       may edit later if you wish<br>
 
     </h3></td>
 
 </tr>
 
 <tr>
 
   <form name="member" method="post" action="add_member.php?a=add">
 
     <td width="46%">Username: </td>
 
     <td width="54%"><div align="right">
 
         <input name="user" type="text" id="user3" class="input">
 
       </div></td>
 
     <tr>
 
       <td width="46%">Password: </td>
 
       <td><div align="right">
 
           <input name="pass" type="text" id="pass4" class="input">
 
         </div></td>
 
     </tr>
 
     <tr>
 
       <td width="46%">Email: </td>
 
       <td><div align="right">
 
           <input name="email" type="type" id="email3" class="input">
 
         </div></td>
 
     </tr>
 
     <tr>
 
       <td width="46%">Name: </td>
 
       <td><div align="right">
 
           <input name="name" type="text" id="name3" class="input">
 
         </div></td>
 
     </tr>
 
     <tr>
 
       <td width="46%">Age: </td>
 
       <td><div align="right">
 
           <input name="age" type="text" id="age3" class="input">
 
         </div></td>
 
     </tr>
 
     <tr>
 
       <td width="46%">Country: </td>
 
       <td><div align="right">
 
           <input name="country" type="text" id="country3" class="input">
 
         </div></td>
 
     </tr>
 
     <tr>
 
       <td width="46%">Favorite Weopon:</td>
 
       <td><div align="right">
 
           <input name="weopon" type="text" id="weopon3" class="input">
 
         </div></td>
 
     </tr>
 
     <tr>
 
       <td width="46%">Favorite Map: </td>
 
       <td><div align="right">
 
           <input name="map" type="text" id="map3" class="input">
 
         </div></td>
 
     </tr>
 
     <tr>
 
       <td width="46%">Quote: </td>
 
       <td><div align="right">
 
           <input name="quote" type="text" id="quote3" class="input">
 
         </div></td>
 
     </tr>
 
     <tr>
 
       <td width="46%" height="22">Image: </td>
 
       <td><div align="right">
 
           <input name="image" type="text" id="image3" class="input">
 
         </div></td>
 
       <input type="submit" name="Submit" value="Submit" class="button">
 
   </form>
 
 </tr>
 
</table> ';
 
}
 
echo $output;
 
include("http://www.69kilobytes.co.uk/footer.htm");
 
?>
 
 
  1.  
  2. <?php
  3.  
  4. include("http://www.69kilobytes.co.uk/header.php");
  5.  
  6. $action = (empty($_GET['a']))? "" : $_GET['a'];
  7.  
  8. if ($action == "add") {
  9.  
  10.     include("connect.php");
  11.  
  12.     $sql = "INSERT INTO members(username, password, email, name, age, weopon, map, quote, image)
  13.  
  14.        VALUES ('$user', '$pass','$email','$name', '$age', '$weopon', '$map','$quote','$image')";
  15.  
  16.     $query = mysql_query($sql) or die("Cannot query the database.<br>" . mysql_error());
  17.  
  18.  
  19.  
  20.     $output =  '<br><table width="90%" height="240" border="0" align="center" cellpadding="0" cellspacing="0">
  21.  
  22.  <tr>
  23.  
  24.    You have been added successfully.<br>
  25.  
  26.    <a href="http://www.69kilobytes.co.uk/cp/admin.php">Back to Admin CP</a>
  27.  
  28.  </tr>
  29.  
  30.  </table>';
  31.  
  32. }else{
  33.  
  34. $output = '<table width="90%" height="240" border="0" align="center" cellpadding="0" cellspacing="0">
  35.  
  36.  <tr>
  37.  
  38.    <td height="20" colspan="2">
  39.  
  40.      <h3 align="center">please fill in below - you
  41.  
  42.        may edit later if you wish<br>
  43.  
  44.      </h3></td>
  45.  
  46.  </tr>
  47.  
  48.  <tr>
  49.  
  50.    <form name="member" method="post" action="add_member.php?a=add">
  51.  
  52.      <td width="46%">Username: </td>
  53.  
  54.      <td width="54%"><div align="right">
  55.  
  56.          <input name="user" type="text" id="user3" class="input">
  57.  
  58.        </div></td>
  59.  
  60.      <tr>
  61.  
  62.        <td width="46%">Password: </td>
  63.  
  64.        <td><div align="right">
  65.  
  66.            <input name="pass" type="text" id="pass4" class="input">
  67.  
  68.          </div></td>
  69.  
  70.      </tr>
  71.  
  72.      <tr>
  73.  
  74.        <td width="46%">Email: </td>
  75.  
  76.        <td><div align="right">
  77.  
  78.            <input name="email" type="type" id="email3" class="input">
  79.  
  80.          </div></td>
  81.  
  82.      </tr>
  83.  
  84.      <tr>
  85.  
  86.        <td width="46%">Name: </td>
  87.  
  88.        <td><div align="right">
  89.  
  90.            <input name="name" type="text" id="name3" class="input">
  91.  
  92.          </div></td>
  93.  
  94.      </tr>
  95.  
  96.      <tr>
  97.  
  98.        <td width="46%">Age: </td>
  99.  
  100.        <td><div align="right">
  101.  
  102.            <input name="age" type="text" id="age3" class="input">
  103.  
  104.          </div></td>
  105.  
  106.      </tr>
  107.  
  108.      <tr>
  109.  
  110.        <td width="46%">Country: </td>
  111.  
  112.        <td><div align="right">
  113.  
  114.            <input name="country" type="text" id="country3" class="input">
  115.  
  116.          </div></td>
  117.  
  118.      </tr>
  119.  
  120.      <tr>
  121.  
  122.        <td width="46%">Favorite Weopon:</td>
  123.  
  124.        <td><div align="right">
  125.  
  126.            <input name="weopon" type="text" id="weopon3" class="input">
  127.  
  128.          </div></td>
  129.  
  130.      </tr>
  131.  
  132.      <tr>
  133.  
  134.        <td width="46%">Favorite Map: </td>
  135.  
  136.        <td><div align="right">
  137.  
  138.            <input name="map" type="text" id="map3" class="input">
  139.  
  140.          </div></td>
  141.  
  142.      </tr>
  143.  
  144.      <tr>
  145.  
  146.        <td width="46%">Quote: </td>
  147.  
  148.        <td><div align="right">
  149.  
  150.            <input name="quote" type="text" id="quote3" class="input">
  151.  
  152.          </div></td>
  153.  
  154.      </tr>
  155.  
  156.      <tr>
  157.  
  158.        <td width="46%" height="22">Image: </td>
  159.  
  160.        <td><div align="right">
  161.  
  162.            <input name="image" type="text" id="image3" class="input">
  163.  
  164.          </div></td>
  165.  
  166.        <input type="submit" name="Submit" value="Submit" class="button">
  167.  
  168.    </form>
  169.  
  170.  </tr>
  171.  
  172. </table> ';
  173.  
  174. }
  175.  
  176. echo $output;
  177.  
  178. include("http://www.69kilobytes.co.uk/footer.htm");
  179.  
  180. ?>
  181.  
  182.  


now when i change

PHP Code: [ Select ]
include("http://www.69kilobytes.co.uk/footer.htm");


to

PHP Code: [ Select ]
include("http://www.69kilobytes.co.uk/footer.php");


the following error appears.

Quote:
Warning: main(http://www.69kilobytes.co.uk/footer.php): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/virtual/site2/fst/var/www/html/cp/add_member.php on line 90

Warning: main(): Failed opening 'http://www.69kilobytes.co.uk/footer.php' for inclusion (include_path='.:/php/includes:/usr/share/php') in /home/virtual/site2/fst/var/www/html/cp/add_member.php on line 90


Is this because a php file is already included?

Ps. i am sorry if im posting too many topics. It is just my luck, running in to problems i can not solve (yet)[/code]

2) What i am trying to achieve?

Right, by using the above form this adds a row to the database with the details. Now i want this to automatically have its own page with its own url id. ie) member.php?id=6
On the main members page, will show the name of the member and beside a link which automatically goes to its ID.

is this possible at all?
Any tuts i can enjoy doin?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Scorpius
  • Proficient
  • Proficient
  • User avatar
  • Posts: 401
  • Loc: Scorpion Hole

Post 3+ Months Ago

Yes, this is easily possible, I don't know of any tutorials off hand, but if you would like to IM me I could show you how to handle you problem.
  • Rabid Dog
  • Web Master
  • Web Master
  • User avatar
  • Posts: 3245
  • Loc: South Africa

Post 3+ Months Ago

The PHP file doesn't exist (footer.php).

After the submission do you want it to automatically go to the new members homepage?

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 143 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.