Jump to content

gristoi

Members
  • Posts

    840
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by gristoi

  1. <?php
    include_once("data/mysql.php");
    
    $mysqlPassword = (base64_decode($mysqlpword));
    
    $con = mysql_connect("$localhost", "$mysqlusername", "$mysqlPassword") or die(mysql_error());
    mysql_select_db("$dbname", $con) or die(mysql_error());
    
    
    $query = "(SELECT COUNT(username) AS Total FROM members)";
      
    $results = mysql_query($query) or die ("Error reading from database");
    $username = mysql_fetch_array($results);
    
    echo $username['Total'];
    
    
    
    ?>
    

     

  2. the innerHTML needs converting into  an Integer / Float etc before a mathimatical function can be performed.

    Try:

    <script>
    function up(){
    var field = document.getElementById("cnt").innerHTML;
    var value1  = parseInt(field);
     document.getElementById("cnt").innerHTML =value1 +1;
    
    }
    </script>
    
    <span id='cnt'>0</span>
    <span style='cursor:pointer;' onclick='up(); '>Go up</span>
    

  3. have a look at the PHP manual http://php.net/manual/en/ . You can use the mail function to send the data you need. Here is an example from the manual:

     

    // multiple recipients
    $to  = 'aidan@example.com' . ', '; // note the comma
    $to .= 'wez@example.com';
    
    // subject
    $subject = 'Birthday Reminders for August';
    
    // message
    $message = '
    <html>
    <head>
      <title>Birthday Reminders for August</title>
    </head>
    <body>
      <p>Here are the birthdays upcoming in August!</p>
      <table>
        <tr>
          <th>Person</th><th>Day</th><th>Month</th><th>Year</th>
        </tr>
        <tr>
          <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
        </tr>
        <tr>
          <td>Sally</td><td>17th</td><td>August</td><td>1973</td>
        </tr>
      </table>
    </body>
    </html>
    ';
    
    // To send HTML mail, the Content-type header must be set
    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    
    // Additional headers
    $headers .= 'To: Mary <mary@example.com>, Kelly <kelly@example.com>' . "\r\n";
    $headers .= 'From: Birthday Reminder <birthday@example.com>' . "\r\n";
    $headers .= 'Cc: birthdayarchive@example.com' . "\r\n";
    $headers .= 'Bcc: birthdaycheck@example.com' . "\r\n";
    
    // Mail it
    mail($to, $subject, $message, $headers);
    

     

    this should get you started

  4. Hi, the hole you have fallen into is that you are dynamically genterating multiple Id's and textareas in a single form. So when you post the data you are posting 6 textareas and 6 seperate ids. The form will automatically grab the last id and textarea. so it will always submit ID6 and textarea 6.

     

    What you want to do in essence is to dynamically create 6 DIFFERENT FORMS. So all you need to do is move your form tags into the while loops. So, from this:

    <form action="editcourses.php" method="post">
    <table border="1" cellspacing="1" align="center" bordercolor="#FFFFFF">
    <tr>
    <td>Course Name</td>
    <td>Edit</td>
    <td>Submit</td>
    <td>Delete</td>
    </tr>
    <?php
    $query = "SELECT * FROM Courses ";
    $result = mysql_query ($query);
    if(mysql_num_rows($result)>0){
                    while($row = mysql_fetch_array($result)) {
                    echo('<tr>' .
                    '<td>' . $row['CourseName'] . '</td>' .
                    '<td><input type="hidden" name="id" value="' . $row['ID'] . '"/><textarea name="coursenametext" rows="2"></textarea>' . '</td>' .
                    '<td>' . '<input type="Submit" name="Submit" value="Submit">' . '</td>' .
                    '</tr>');
            }
    }
    if(isset($_POST['Submit']))
    {
    $query1 = "UPDATE courses SET courseName = '".$_POST['coursenametext']."' WHERE ID = '".$_POST['id']."'";
    $result1 = mysql_query ($query1);
    }
    ?>
    </table>    
    </form>
    

     

    to this:

    
    <table border="1" cellspacing="1" align="center" bordercolor="#FFFFFF">
    <tr>
    <td>Course Name</td>
    <td>Edit</td>
    <td>Submit</td>
    <td>Delete</td>
    </tr>
    <?php
    $query = "SELECT * FROM Courses ";
    $result = mysql_query ($query);
    if(mysql_num_rows($result)>0){
                    while($row = mysql_fetch_array($result)) {
                    echo'<form action="editcourses.php" method="post">';
                    echo('<tr>' .
                    '<td>' . $row['CourseName'] . '</td>' .
                    '<td><input type="hidden" name="id" value="' . $row['ID'] . '"/><textarea name="coursenametext" rows="2"></textarea>' . '</td>' .
                    '<td>' . '<input type="Submit" name="Submit" value="Submit">' . '</td>' .
                    '</tr>'
                    '</form>';
    );
            }
    }
    if(isset($_POST['Submit']))
    {
    $query1 = "UPDATE courses SET courseName = '".$_POST['coursenametext']."' WHERE ID = '".$_POST['id']."'";
    $result1 = mysql_query ($query1);
    }
    ?>
    </table>    
    
    

     

  5. The sites you are reffering to mainly use the MVC (Model View Controller) design pattern. this reflects in the URL. Each Controller has a set of Actions which take in the user parameters and pass them to the model etc.. Therefore if you are passing a variable through the url:

     

    // www.somewebsite.com/ControllerName/ActionName/Variable1Name/Variable1Value/Variable2Name/Variable2value
    // which translates looks like:
    // www.somewebsite.com/Loginpage/loguserin/myusername/name1/password/logmein
    
    

     

    obviuously you would not pass sensitive data like this, but i hope it explains it for you

  6. You are putting your textarea 'coursenametext' into a loop. therefore if you have 6 textareas they are all going to have the same name, so the form will more than likely only take the value from the last textarea ( number 6) and ignore the rest, regardless of which submit button you are pressing

  7. A double submission can be due to something as simple as the user double clicking the submit button before the data has posted successfully , in essence submitting the form twice. If this is the case then you can either validate that the posted data hasn't been submitted already, or use some jquery / JavaScript to disable the submit button after the first click

  8. Hi, If you are looking for an elegant style overlay with fading in and out etc, then you might want to look at using jquery to achieve this effect. There are a lot of pre built plugins at your disposal that already do what you need. A good example is on this home page:

     

    http://flowplayer.org/tools/demos/overlay/index.html

     

    r you can search through the jquery repository:

     

    http://plugins.jquery.com/

     

     

  9. if you want to get to the bottom of this your are at least going to have to post your output, or even better the code that you wrote to generate it. Without being able to see how you have formatted your output, the one thing that jumps to mind is the font you are using for your output. for example the Georgia font displays some of its numbers a few pixels higher / lower depending on the number.

     

    but without any code I couldnt tell you any more.

  10. <a href="index1.php?page=coveringaplane">Here is an article</a>

    is correct.

    The error you are getting is telling that you have a syntax error on or before line 3 of your coveringaplane.php script.

     

    can you post the first few lines of the coveringaplane.php script

  11. you need to move your variables into the loop:

     

    
    
    echo "<h3>Profiles</h3><br/><br/>";
    
    while($row=mysql_fetch_array($qry))
    {
    $name=$row['name'];
    $mobile=$row['mobile'];
    $email=$row['email'];
    
    
    
    echo "Name: <input type=\"text\" name=\"char\" value=\"$name\"> ";
    echo "<br/>";
    echo "Mobile: <input type=\"text\" name=\"number\" value=\"$mobile\"> ";
    echo "<br/>";
    echo "Email: <input type=\"text\" name=\"mail\" value=\"$email\"> <br/>";
    
    echo "<form action=\"update.php\" method=\"post\">";
    echo "<input type=\"submit\" name=\"submit\" value=\"submit\">"; 
    }
    
    
    
    
    

     

    also you have a form with nothing in it?

  12. Cunoodle2 - I think your posting your reply in the wrong thread, teitoklein1 hasn't posted any code.

     

     

    teitoklein1, you really need to post the code so we can help you with your issue. But from the sound of it you need to use the echo function to output the variable. But without seeing your code there is not much that can be done

  13. You need to use source contol software to manage your versions. One of the more popular free programs is subversion.

     

    This allows you to make a repository for your code from where developers can check the code out to work on it. The benifit of this is it stops the code being overwritten by accident . Also every change is logged so if you roll up and new version an it goes wrong you can easily roll backto the last version.

     

    Have a look at:

    http://subversion.tigris.org/

     

     

×
×
  • 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.