Jump to content

michaelkirby

Members
  • Posts

    40
  • Joined

  • Last visited

    Never

Everything posted by michaelkirby

  1. Hi, Ok I understand that but maybe I have made a mistake in my code because I can't display the category id or write it to the db. Here is the code I'm using: Form: <form action="addbrieftocategory.php" method="get"> <p>Select a category:<br /> <select name="categories"> <?php $selectCategoryQuery = "SELECT * FROM categories ORDER BY categoryname"; $selectCategoryResult = mysql_query($selectCategoryQuery) or die(mysql_error()); while($row1Category=mysql_fetch_array($selectCategoryResult)) { ?> <?php echo '<option value="'.$row1Category['categoryid'].'">'.$row1Category['categoryname'].'</option>'; ?> <?php } ?> </select> <input name="Save" type="submit" value="Upload"> </form> Then the page the action goes to: <?php session_start(); require "connect.php"; $briefid = mysql_insert_id($connection); $categoryid = $_GET['categoryid']; echo $categoryid; $query = "insert into briefcat values ('".$briefid."','".$categoryid."') "; $result = @mysql_query($query, $connection)or die ("Unable to perform query<br>$query"); //header("Location: briefsassignedto.php"); //exit(); ?> Is this correct?
  2. So when I wrap it in the form, the action pointing to the php page where I want the values to go I understand. But then to get the values? As I want to ultimately get the id and save it into a table.
  3. Hi all, I have a drop down reading from a table in the database. When I select the option from the drop down i would require this information to be passed over to another page. Can I use a link? If so is what I am doing correct? Please see the code I'm using below... drop down for category: <p>Select an existing industry:<br /> <select name="categories"> <?php $selectCategoryQuery = "SELECT * FROM categories ORDER BY categoryname"; $selectCategoryResult = mysql_query($selectCategoryQuery) or die(mysql_error()); while($row1Category=mysql_fetch_array($selectCategoryResult)) { ?> <?php echo '<option value="'.$row1Category['categoryid'].'">'.$row1Category['categoryname'].'</option>'; ?> <?php } ?> Then I was wondering how to pass the details to another page using a link?? <a href="addbrieftocategory.php?categoroyid=<?php echo $row['categoryid']?>" >[+] </a> Which then takes me to another page where I can insert this id into a database table. Can someone please advise me. Thanks in advance
  4. Ok thanks for both your comments still quite unsure exactly what I need to do: I have this code to create the upload: if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("upload/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]);//change to Timp folder // "C:/upload/" . $_FILES["file"]["name"]);//change to Timp folder //echo "Stored in: " . "C:/xampp/htdocs/Timp/UserLogin/upload/" . $_FILES["file"]["name"]; echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; } } But how do I then save the file location into a variable( I Guess??) then how to write sql to insert into the database? Any ideas?
  5. The part im stuck on is how to save the path of the image to the database. I have a way of uploading the image and saving it to a folder (process of saving to a temporary folder then moving to final destination.) What I'm trying to do is add a profile picture for each user so I need to store the path of the picture they uploaded. So essentially I need the file path to be saved into the user table of the user logged in, to then later recall this file on the profile page. I'm just not sure how to get the file path and then write the SQL to save it to the database. I guess it will be some kind of Insert into user...... Any help is much appreciated.
  6. Hi, I have the structure to create an upload of a file which can include images. What I really need to do is to save the file path in the database, but don't know how to do this. Can anyone give me any help at all?? Thanks in advance
  7. Hi, Thanks for your advice, How do I go about storing the path of the file in the database?? Thanks in advance
  8. Hi, I have a question regarding file uploads. I have a profile page which displays a user details that they registered. This data is displayed from the users table. For the profile page I would like to add a display picture. From my understanding I would need to store this as a BLOB in the DB?? How would I then recall this picture and display it? I have created a a simple file uploader which can upload to a folder on my computer, is this re usable? Thanks in advance!
  9. Thanks both of you for your input!! Much appreciated!
  10. Hi, I have a table for users which has two types of users. In the table there is a usertypeid which gets set to either 1 or 2 depending on what type of user is registered. When a user logs in to the website I have set it up to have a profile page which allows them to see all the details that they had input. I want to have links on the profile page to enable them to carry out tasks, but the links will be different for the different users that log in. So i needed a way to hide them, so I was thinking using an IF statement.... IF(usertypeid == 1) { Display link; } However I'm not sure how to get the usertypeid from the users table of the user logged in and assign it to the variable. Any ideas???? I managed to use the username from the SESSION variable to do this, but I need it for usertypeid column. Thanks in advance
  11. Hi, Thanks for the reply. At the moment all I want to do is send emails for a contactUs form and also eventually to get email confirmation to a users email address to verify the account. The email address that I would want the email to come to would be a hotmail account. Do I need to use something like Mercury?? or is their another way? All your help is much appreciated as I'm still learning and don't know how to do everything. Thanks!
  12. Hi all, I have been investigating how to send email from my application. There are many examples that are available that show how to send a simple message. I understand how this is working but getting a bit confused when it comes to running and the error I get. Once I run the application I get the following error: Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\Timp\UserLogin\contactusmailform.php on line 9 After investigating this there has been suggestions to change ports etc but i really don't understand the problem. Can anyone help me out at all??
  13. Hi, I'm new to PHP and still learning how to do things. I have a table which stores all of the users that have registered with the website. One of the tasks is to create a new brief (Adding details from a form) to a brief table. From the user logged in I want to be able to write to the brief table showing the user Id of the person who created the brief. When I'am writing the query to store brief details do I just some how use the session variable to add the User Id?? Anyone able to help me out??
  14. Thanks!!! Worked a treat!! It's simple when you know how but I am just starting out as a developer so the help is much appreciated!!
  15. Hi all, I'm new to PHP and have a question regarding user profiles. Currently I have a table called users which stores all the information regarding the users. When the user logs into the session I would like to be able to retrieve the details of that user and have it displayed on a profile page. I can display the user that is logged in but not sure how I would go about displaying all the details they entered when they registered. Can any one help me please!!!
×
×
  • 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.