-
Posts
840 -
Joined
-
Last visited
-
Days Won
1
Everything posted by gristoi
-
<?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']; ?>
-
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>
-
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 = '[email protected]' . ', '; // note the comma $to .= '[email protected]'; // 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 <[email protected]>, Kelly <[email protected]>' . "\r\n"; $headers .= 'From: Birthday Reminder <[email protected]>' . "\r\n"; $headers .= 'Cc: [email protected]' . "\r\n"; $headers .= 'Bcc: [email protected]' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); this should get you started
-
http://php.net/manual/en/language.oop5.autoload.php
-
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>
-
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
-
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
-
Where are you trying to send the mail function from? If it's your localhost do you have an email server installed on your machine to actually relay the email?
-
Try moving $people = array(); Just before your while loop. At the moment you are creating a new array on every loop instead off adding to one array
-
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
-
please help me place overlay box below icon that was clicked
gristoi replied to jason310771's topic in Javascript Help
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/ -
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.
-
<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
-
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?
-
How to use URL to select another function inside the same PHP?
gristoi replied to Terje_Hvidsten's topic in PHP Coding Help
Lol, have fun -
How to use URL to select another function inside the same PHP?
gristoi replied to Terje_Hvidsten's topic in PHP Coding Help
How are you retrieving the data from the URL in the index.php. Where's your code to trigger the function? Example: If ($_GET['func']) { switch($_GET['func']) { case 'DisplayPlaces' : DisplayPlaces(); Break; ....................... } } -
How Do I send email into gmail account from localhost ?
gristoi replied to abhi10kumar's topic in Applications
You don't need to make any changes to php ini. The mail function is a default part of the language. You do however need to have an email server on your local host to allow you to send an email, such as postfix or exim -
How to use URL to select another function inside the same PHP?
gristoi replied to Terje_Hvidsten's topic in PHP Coding Help
You need to use the get parameter. This allows you to pass variables into the URL: Http://www.somesite.com?var1=something&var2=somethingelse&functionparam=function1 // to get data from URL If ($_Get['functionparam']=='function1') { $var1 = $_GET['var1']; // run function } I hope this is what you are referring to -
PFMaBiSmAd is right, I am sorry, I was under the assumption you had wrote the dialog window yourself. You might want to look into taking more contol of the download aspect of your site. A good place to start is the jquery UI. Your could perhaps look at writing your open dialog window using jquery. http://docs.jquery.com/UI/Dialog
-
If it's JavaScript then try: var save = confirm('are you sure you wish to save this ..'); if (save ==true){ Window.location = http://www.URL.tosendemailfunction?send=true&id.... } else { window.location = somewhere else } Hope this gives u the general idea
-
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
-
Hi, your request is a bit vague. Are the buttons part of a form that sends via post / get? Or a JavaScript confirm window?
-
for ($i=1;$i >=1;i++) { $id = rand(); mysql_query("INSERT INTO comments(id) VALUES ('$id')"); } Should give u an infinite loop
-
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/