davidannis
-
Posts
627 -
Joined
-
Last visited
-
Days Won
2
Posts posted by davidannis
-
-
change
echo 'Book Title '.$i.': '.$BookTitle[$i].'<br />';
to
echo 'Book Title '.($i+1).': '.$BookTitle[$i].'<br />';
-
Alternatively, if you stick with this login system (which I would recommend against) this line, which you should a gives you the username.
$username = $_COOKIE['ID_my_site'];
and you should have it on all your pages already.
-
I really don't like the way your login script stores the password in a cookie. That's not very secure. I guess it depends what you are trying to do but storing a password in plain text and passing it back from the browser with every page request is just sloppy.
To address Requinix's concern you should create a staff_id column as she detailed in post #6 and substitute $_SESSION['staff_id'] for $_SESSION['username'] in the code I posted.
-
At the top of the login script add a
session_start();
Note: this needs to happen before you output anything, so just put it at the top of the script.
Then after the user is verified do this:
$_SESSION['username']=$variable_you_stored_username_in ;
on the script that you use to record form data you'll do the session_start() at the top again and have something like this:
$sanitized_field1=mysqli_real_escape_string($connection, $_POST[field1']; // sanitize all fields thsi way $sql="INSERT into `dispatch` ('field_name', 'some_other_name', 'username') VALUES ('$sanitized_field1', '$sanitized_field2', $_SESSION['username'])";
-
Link not working for me.
-
I think you want to use jQuery and Ajax. I would suggest buying a book and working through it.
-
Try this:
<?php if ($_POST['games']!='') echo '<h1>Last time you selected '.$_POST['games'].'</h1>'; ?> <form action="mypage.php" method="POST"> <p>Select a game:</p> <select name="games" size="3"> <option value="1">game1</option> <option value="2">game2</option> </select> <input type="submit"> </form>
save it as mypage.php and run it a couple of times to see how it works.
-
Can you provide a little more detail on what you are trying to do? Where do you want the values to come from?
-
mikosiko is right. You need to post code. Without seeing any code my best guesses are that you need an actual table name where you have (table name) in your select, you don't have a valid connection to the database, or you are not retrieving and displaying the results after the mysql_query.
-
$myvar=$_SERVER['REMOTE_ADDR']; -
Use the php mail function. http://php.net/manual/en/function.mail.php If you have trouble post again and we'll help.
-
What Jessica said is do something like this:
//Note: removed ! in the line below if(isset($_GET['limit'])) { $num_rows=intval($_GET['limit'] ) ; //cast to an integer - makes it work for any number of rows $fetch = mysql_query("SELECT * FROM (table name) LIMIT 0, $num_rows")or die(mysql_error()); }
also needed to remove the test for if limit was 10
-
I have added Dr Freak code after the insert and it gives me 2 strange errors:
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, object given in /home...Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /home....Any idea what this translate to please?You never connected to the database. You will need to create the database and add the table first. I'd recommend using PhpMyAdmin. Google mysql php tutorial for an overview of how MySQL works or perhaps Jessica can recommend one. Then you need a line in your code before you do anything wiht Mysql like
$con = mysqli_connect("localhost", "my_user", "my_password", 'my_db');
-
I think that you should not try to create the table in your script.
mysqli_query($con,"CREATE TABLE $tbl_name");
Set it up once, before your site goes live and forget about it. When you create the table make the phone column a unique key. This will not allow a duplicate phone to be inserted. Before the insert try something like:
$result=mysqli_query($con,"SELECT * FROM $tblname WHERE phone=$phone"); $row_cnt = mysqli_num_rows($result); if ($row_cnt>0){ echo "this phone number has already been used"; }else{ // Do your insert here }
-
<form action=bills.php method=POST<input type=submit name=submit value=Remove</form>
Valid HTML would be helpful here.
I pointed that out in replies 18 and 19 on this thread. If OP doesn't fix it this go around I think I'm done with this topic.
Apologies for the snarky tone.
-
You didn't apply the previously mentioned fixes. This:
<td><form action=bills.php method=POST<input type=submit name=submit value=Remove</form></td>
should be something like this:
<td><form action=\"bills.php\" method=\"POST\"> <input type=\"submit\" name=\"submit\" value=\"Remove\"><input type=\"hidden\" name=\"id\" value=\"$id\"></form></td>
-
You can concatenate the two fields:
$cost=$_POST['pounds'].'.'.$_POST['pence];
-
I would save the data to a database and when they go to the first page check to see if a session exists and if it does retrieve the data and fill the form.
-
Are you trying to have the two pages open in separate tabs in the user's browser?
-
My guess is that you need a </form><form> between the two submit buttons so that only the top or bottom information gets submitted, but I'd need to see the form and the script to do more than guess.
-
Could you use curl and screen scrape it from the FHA/VA sites? It might fail if they change the sites but until then...
-
I believed that I answered the question: told you what the errors were and quoted the two lines of code that had the errors in them. I then went on to suggest that if you were coding in a good IDE all of the errors you posted would have been far less likely to occur and easier to spot. Please read my posts again.
-
I don't see where you assign a value to $message. I've used tectite form mailer on godaddy, but on a linux VPS. No reason it shouldn't work for you and it is pretty flexible.
-
There is not enough information in your post to begin to answer the question. What is the application written in? How many colors need to change? On how many screens? Is color dependent on some variable or static? Categories of what? Are the categories stored in a database? What information needs to be stored about each category? The list could go on. Please describe the application and the changes you want in detail to get a meaningful answer.
counting records
in PHP Coding Help
Posted
jarv, you need the parentheses around ($i+1). I edited the post but not before you saw it. or TOA's solution will work.