Squidge 101 Newbie Poster

Thatis an example from PHP.net - this is not from me.t

<?php

    $to = '' // email address where to send
    $subject = '' // Subject matter captured from form
    $message = '' // captured from form

    mail($to, $subject, $message); // Sends the message

?>
Squidge 101 Newbie Poster

Sorry i miss read. you would use the "mail" function:

http://php.net

That should help.

--

I hadnt seen the link you posted.

I have never had to do this that way.

The SMTP would be configured by your hosting, so just use the "mail" function from my link to PHP.net

--

Example:

<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>
Squidge 101 Newbie Poster

This is a copy of the drop down i have used on this site: Click Here

<form id="form" method="POST" action="<?php $_SERVER['PHP_SELF']; ?>">
  <select id="sel" name="category">
        <option value="Select">Please select a gallery..</option>
            <?php
                $cxn = mysqli_connect($host,$user,$pword,$db)
                    or die ("Connection failed");
                $query = "SELECT category_id,category_name from gallery_category";
                $result = mysqli_query($cxn,$query)
                    or die ("Query Failed");
             while( $row_1 = mysqli_fetch_array( $result ) )
                {
                    @$photo_category_list .="<option value='$row_1[0]'";
                if ( $_POST["category"] == $row_1[0]) {
                   @$photo_category_list .= " selected";
                    }
                    @$photo_category_list .=">$row_1[1]</option>\n";
                }
                echo $photo_category_list
            ?>
        </select>
        <input name="Submit" type="submit" value="Change Gallery" >
    </form>
Squidge 101 Newbie Poster

is this Windows or Linux based server?

Squidge 101 Newbie Poster

As pritaeas mentioned some packages havent been maintained for a while. But you will find side branches ofpackages which are being maintained out side of PEAR.net. This can be easily added to your repo

Squidge 101 Newbie Poster

I have used PEAR before, but i though it was being replaced by another version. I cannot remember the name of the darn thing. think it was phasr or something like that

Squidge 101 Newbie Poster

+1 for XAMPP very easy to use.

I have used EasyPHP in the past, but personal preference i choose XAMPP

Squidge 101 Newbie Poster

I can't figure out why the contact form doesn't send me a notification email telling me someone submitted a form.

You need to call in (include/require_once) when the form is submitted, which triggers an email

I don't know how to send a user a message through their email saying that we got their form submitted.

As above

I can't figure out how to put a message in the same window saying "Thanks for Submitting Form" without putting this on another page.

You could use if(!isset()) so if the form is not submitted you display the form, else you show the "Thanks", with a timed re direct(?).

I can't figure out how to make fields required.

Basic HTML fields????

I can't figure out a solution in putting ways in checking for real emails, so I don't get spammed by users sending fake emails (the email form has to have the @ symbol in order for it to work).

Click Here

I can't figure out how to allow user's to only send form once.

Login some kind of DB table

If you need help to develop this drop me a PM with further details

Squidge 101 Newbie Poster
<?php

    if ($second == "")
    {
        if($first - $third <= 5)
        {
            echo "<img src='images/img1.png' />";
        }
        else 
        {
            echo "<img src='images/img3.png' />";
        }
    }
    else
    {
        if($first - $second <= 5)
        {
            echo "<img src='images/img1.png' />";
        }
        else
        {
            echo "<img src='images/img2.png' />";
        }
    }

?>

Img 3 will never show as they way you have your logic <=5 & >5 what else is there?

It will be greater or less than or equal to :)

Squidge 101 Newbie Poster

Is this thread now solved?

Squidge 101 Newbie Poster

You can apply formatting to the email also

Squidge 101 Newbie Poster

<form id="form" name="form" method="post" action="name_of_script.php">
<h1>Contact Us</h1>
<label>Name</label>
<input type="text" name="name" id="name" />
<label> Email
</label>
<input type="text" name="email" id="email" />
<label>Comments
</label>
<input type="text" textarea name="comment" id="comment"></textarea>
<button type="submit">Sign-up</button>
<div class="spacer"></div>
</form>

Very basic, but you should get the idea:

<?php

$to = '[YOUR_EMAIL_ADDRESS]';


//Clean data
$name = strip_tags(trim($_POST[name]));
$email = strip_tags(trim($_POST[email]));
$comment = strip_tags(trim($_POST[comment]));

////

$subject = "New form submitted";

$message = $name . "has submitted a form\n";
$message .= "Email address " . $email"\n";
$message .= "Comment: " . $comment;


mail($to,$subject,$message);


?>
Squidge 101 Newbie Poster

can you post your form code?

Squidge 101 Newbie Poster

lenthy post well that is all about the PHP

You need to include your post data or the sql is not goning to update any info.

To double check the data is populated in the POST array:
var_dump($_POST);

If this is showing the data, you will need to clean it (never trust user input)

Then assign the POST data:

`

$Studentid = $_POST['Studentid'];
$id = $_POST['id'];

`

You should then be able to update the data in the DB

Squidge 101 Newbie Poster
   $host="localhost"; // Host name
    $username="root"; // Mysql username
    $password="root"; // Mysql password
    $db_name="project"; // Database name
    $tbl_name="add_marks"; // Table name
    // Connect to server and select database.
    mysql_connect("$host", "$username", "$password")or die("cannot connect");
    mysql_select_db("$db_name")or die("cannot select DB");
    // update data in mysql database
    $sql="UPDATE $tbl_name SET Studentid='$Studentid' WHERE id='$id'";
    $result=mysql_query($sql);
    // if successfully updated.
    if($result){
    echo "Successful";
    echo "<BR>";
    echo "<a href='edit_marks.php'>View result</a>";
    }
    else {
    echo "ERROR";
    }

Is this the code you use to update the DB?

Where is the POST data?

Squidge 101 Newbie Poster

Can you provide your form code, and also the DB layout?

Squidge 101 Newbie Poster

<form action="home.php" method="get"> Email:<input type="text" name="email"/> </form>

also try adding id="email"

<form action="home.php" method="get"> Email:<input type="text" name="email" id="email"/> </form>

Squidge 101 Newbie Poster

not sure if this is correct but remove the die statment from your redirect:

<?php
if ($Count == 0)
 {
 mysql_close();
 header("Location: Errors/Login/Existance.php");
 exit();
 }
?>

Also check the relativness of the path to your current script

Squidge 101 Newbie Poster

@BadManSam, for user login form as veedeoo syas if this is not done correctly you can leave your complete system open for some very powerful attacks.

I would suggest a frame work that has been tried and tested and maintained. 2 that come to mind would be Zend_Framework found Here, or CodeIgnitor Here

Both are throughly tested for attacks, and will give you the functionality you are after

Squidge 101 Newbie Poster

You could always change the string to lower case if you do not want to take case in to it:

$username='TestName';
$user='testname';

$username = strtolower($username);
$user = strtolower($user);

if ($username==$user){
    print "This is the result I want." ;
}else{
    print "This isn't the result I want." ;
}
Squidge 101 Newbie Poster

i maybe wrong but i think you need to have your session before any output, also i notice you are changing between MySQL and MySQLi. Is there a reason for that?

Squidge 101 Newbie Poster

DHCp server can be used for many things. If you have no need fo rit, i wouldnt worry to much. They assign IP address to units in a network, for example if you have a PXE server, any unit that connects to this would require an IP, so DHCp assigns for this, and away you go.

Inregards to where your PC's are getting there IP/DHCP from, this would be your router. Most modern routers, will act as a DHCP for easy local network setup. If you wanted to use a DHCp server you would need to disable this in your router. However this would require you to leave the DHCP server always on.

Squidge 101 Newbie Poster

yes. I would suggest driving the AVAILABLE page by PHP and database

Squidge 101 Newbie Poster

dwlamb, with includes you need to include the path unless you have include the include path in your ini file

Squidge 101 Newbie Poster

It seems this is an issue with PHP 5.

Really??? you have an error some where

Squidge 101 Newbie Poster

thanks to all.

i think diafol is right, i will try it.

let me know how you get on. looks interesting

Squidge 101 Newbie Poster

no is the short answer to that, PHP is a server side logic language. You would be looking at C, or C++ something like that

Squidge 101 Newbie Poster

do you have a typo in the file name?

is that the file location?

Squidge 101 Newbie Poster

You would build the table elements as you run through the results of your query.

As JorgeM has pointed out, you would build your TD/TR etc as you step through your loop.

Start and end your table outside of the loop:

<table>
<?php
    WHILE LOOP/IF LOOPDO WHILE LOOP
?>
</table> 
Squidge 101 Newbie Poster

sorry long day today :)
<img src='get.php?image_id=$row[lastid]'> will only show one image.

<img src='$row[lastid]'> this is taking the assumption you have saved the image as the ID

hwoarang69 commented: it almost worked +0
Squidge 101 Newbie Poster

hwoarang69

<img src='get.php?image_id=$row[lastid]'>

i would suggest resizing the image during the upload process, as resizing in the browser will slow it down

hwoarang69 commented: ty +0
Squidge 101 Newbie Poster

You have changed line 9. remove the "mysql_query" and ()

`$sql = "SELECT * FROM image WHERE user_id = $user_id ORDER BY image_id DESC";'

You would need to address <img src=\"get.php?image_id=$lastid\"></img> as it would be $row['lastid'] it $lastid is from DB

hwoarang69 commented: thanks +2
Squidge 101 Newbie Poster

Have a look here: http://php.net/manual/en/function.mysql-fetch-assoc.php

$image seem's to be very popular variable, the below is not tested

session_start();
include("connect.php");
$user = $_SESSION['username'];
if($user)
{
    $user_id = $_SESSION['user_id']; //get user_id who ever is loged in
    $sql = "SELECT * FROM image WHERE user_id = $user_id ORDER BY image_id DESC";
}

echo "your gallery<br/><br/><br/>";
echo "<a href='upload.php'>upload image</a>";
echo "<a href='index.php'>home</a><br/><br/><br/>";
echo '<table>'; // Your table
echo '<tr>'; // first table row


$result = mysql_query($sql);

if (!$result) {
    echo "Could not successfully run query ($sql) from DB: " . mysql_error();
    exit;
}
$n = 0;
while ($row = mysql_fetch_assoc($result)) 
{
    echo"<td> //how to do it with using get.php
        <img src=\"get.php?image_id=$lastid\"></img>//print image
        </td>";

    $n++;
    if($n == 4)
    {
        echo '</tr><tr>'; // Start a new row at 4 cells
        $n = 0;
    }
}
echo '</tr>';
echo '</table>';
hwoarang69 commented: thanks alot +0
Squidge 101 Newbie Poster

I use Notepad++ for coding, but inline editing TinyMCE (easy to setup, open source, large support community if needed)

Squidge 101 Newbie Poster

Your Array is empty also your if statement is opened correctly you had missed the first set {} from the IF

if ($v_name==""){
    $query="DELETE FROM key_show WHERE code='$v_name'";
    }else{
    $query="insert into key_show(code) values('$v_name')";
    mysql_query($query) or die(mysql_error());
    }