-
Posts
1,842 -
Joined
-
Last visited
Posts posted by marcus
-
-
Also if you were to have multiple checkboxes [say you were deleting pieces of mail]
<input type="checkbox" name="mail[]" value="1"> <input type="checkbox" name="mail[]" value="2"> <input type="checkbox" name="mail[]" value="3"> <input type="checkbox" name="mail[]" value="4"> <input type="checkbox" name="mail[]" value="5">
Then:
$mail = $_POST[mail]; if($mail){ echo "You selected:<br>\n"; foreach($mail AS $mailid){ echo $mailid . "<br>\n"; } }else { echo "No mail selected\n"; }
-
<input type="checkbox" name="name" value="1">
If the box is checked, the value is 1, if it's not checked it will have no value.
If the value is stored in your database, just select it, say if the value in the database equaled one then the box would be checked:
$sql = "SELECT * FROM `tbl_name` WHERE `value`= 'value'"; $res = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_assoc($res); if($row[name] == 1){ $check = " CHECKED"; }else { $check = ""; } echo "<input type=\"checkbox\" name=\"name\" value=\"1\"$check>\n";
Then passing it:
$name = $_POST['name']; if($name){ $sql = "SELECT * FROM `tbl_name` WHERE `value` ='value'"; $res = mysql_query($sql) or die(mysql_error()); $row = mysql_fetch_assoc($res); if($name == $row[name]){ //no need to update }else { //update query } }else { //no update }
-
While calling for the file, add in your home directory to where the images are
"/home/username/public_html/folder/$_SESSION[id].gif"
-
Have you used dbase_create() to create the database?
-
I thought you would have caught on to putting it after you called the if statement...
if($_POST){ print_r($_POST); }
-
Try removing the spaces from the variables
$row ['taskid'] //to $row['taskid']
-
File extensions are case sensitive, so say you have JPG, but you were asking for jpg it wouldn't read it the same way.
-
After:
if ($_POST)
-
try:
if(file_exists("$_SESSION[id].gif")){ $pic = "$_SESSION[id].gif"; } if(file_exists("$_SESSION[id].jpg")){ $pic = "$_SESSION[id].jpg"; } if(file_exists("$_SESSION[id].bmp")){ $pic = "$_SESSION[id].bmp"; }else { $pic = "nopic.gif"; }
-
If it's your own message, you have to translate it yourself.
-
Something like:
$sql = "SELECT * FROM `tbl_name` WHERE `field_name` LIKE '%
%'"; $res = mysql_query($sql) or die(mysql_error()); echo mysql_num_rows($res);
??
-
The number of rows:
$num = mysql_num_rows($resultt);
A value in a field of that row:
echo "$row['field_name']";
-
When you pass the data by clicking the submit button.
-
You can't call the file without the extension, you could always do something like:
if(file_exists("$_SESSION[id].gif")){ $pic = "$_SESSION[id].gif"; }else { if(file_exists("$_SESSION[id].jpg")){ $pic = "$_SESSION[id].jpg"; }else { if(file_exists("$_SESSION[id].bmp")){ $pic = "$_SESSION[id].bmp"; }else { $pic = "nopic.gif"; }
Try that.
-
The variables aren't defined when you're updating the table. They're defined when you call the form itself.
Do print_r($_POST) and tell us what you get.
-
if($db){ echo "working"; dbase_close($db); }else { echo "not working"; }
-
if(!$_SESSION[id]){ $pic = "nopic.gif"; }else { $pic = $_SESSION[id]; }
-
Any google search could give you a nice tutorial, if you want something to do it for you:
-
Well the profile itself would just contain basic information about the account, and the user profile that the user has designed themselves.
So basically you want to have some main fields in your database:
-username
-age
-email
[other info they would show on their page]
then their actually profile make a text field named "description"
Say you wanted to have the profile URL look something like: /users/profile:username
MOD Rewrite does the trick there: [put into your .htaccess]
RewriteEngine On RewriteRule ^users/profile\[^*]*)$ /profile.php?username=$1 [L]
Then profile.php would consist of something as such:
<?php $username = $_GET[username]; //you can protect it later $sql = "SELECT * FROM `users` WHERE `username`= '$username'"; $res = mysql_query($sql) or die(mysql_error()); if(mysql_num_rows($res) == 0){ echo "<b>This user does not exist!</b>\n"; }else { $row = mysql_fetch_assoc($res); echo "<table border=0 cellspacing=3 cellpadding=3 width=600>\n"; echo "<tr><td align=center>Welcome to <b>$username's</b> profile</td></tr>\n"; echo "<tr><td valign=top>$row[description</td></tr>\n"; echo "<tr><td valign=top>$username's Stats:<br>Age: $row[age]<br>E-Mail: <a href=\"mailto:$row[email]\">$row[email]</a></td></tr>\n"; echo "</table>\n"; } ?>
Now of course you could easily edit it to make it your own.
-
Do the smart thing and check if that ID even exists first.
-
htmlspecialchars()
-
Since your cookie has a value I suggest checking to see if the cookie has the value you set it to.
So just use ONE if statement to see if the cookie equals that, then if it does, it's there first time, or they edited the cookie.
-
What you've shown us, is that all of check.php's file contents, or just a snippet?
-
You miss ended the table data cell. You ended it with <td>, not </td>
string concatenation
in PHP Coding Help
Posted