mariocesar Posted October 22, 2006 Share Posted October 22, 2006 Hello, this php scrip works fine, get the info from our clients, send an e-mail back to them and download a file all at ones, the only problem is that the client has to enter the main info (name, phone, e-mail) all over again if they want to upload a file, because the form to upload files has those entries, I want to delete those entries from that form, if I do this the scrip don't send the e-mail back to them but download the file ok, how can I get their main info form the login system? because they have to be registered to upload files. Here is the form[code]<? // check to see if user is a valid logged in user if (!$logged_in_user) { // if not, show an error message and a hyperlink to the login page echo "<H3>Whoops!</H3><BR>"; echo "To upload files you have to register, or login if you are allready registered.<BR><BR>"; echo "<div class='powerftp'><A HREF='login.php'>login</A></div><BR>"; echo "<div class='powerftp'><A HREF='register.php'>Register</A></div>"; exit; } // otherwise, welcome the user and show main page content // and a link to the logout page echo "You are login as, ".$logged_in_user."."; ?> <div class="formcontent">Do you have a new project ready for production? Just submit your project and file information in the form below and a representative will contact you soon. </div></td></tr></table> <tr> <td height="100%"><table width="100%" border="0"> <tr> <td width="60"></td> <td><table align="center"><FORM ENCTYPE="multipart/form-data" method="POST" action="quoteuploadon.php" name="form" > <TABLE cellSpacing=1 cellPadding=4 width="100%" border=0> <TR vAlign=top bgColor=#7793ad> <TD class=formtitle align=left width="100%" colSpan=2>Contact Information:</TD> </TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>Your Name:</TD> <TD class=formcontent width="100%"><INPUT type="text" size="40" name="Name"> <BR></TD></TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>Company:</TD> <TD class=formcontent width="100%"><INPUT type="text" size="40" name="Company"> <BR></TD></TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>Address:</TD> <TD class=formcontent width="100%"><INPUT type="text" size="40" name="Address"> <BR></TD></TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>City, State, Zip:</TD> <TD class=formcontent width="100%"><INPUT type="text" size="40" name="Citystzip"> <BR></TD></TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>Phone Number:</TD> <TD class=formcontent width="100%"><INPUT type="text" size="40" value="" name="Phone"> <BR></TD></TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>Fax Number:</TD> <TD class=formcontent width="100%"><INPUT type="text" size="40" name="Fax"> <BR></TD></TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>E-mail Address:</TD> <TD class=formcontent width="100%"><INPUT type="text" size="40" name="Email"> <BR></TD></TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>Preferred Response:</TD> <TD class=formcontent width="100%"><SELECT name="Responseby"> <OPTION value=E-mail selected>E-mail</OPTION> <OPTION value=Phone>Phone</OPTION> <OPTION value=Fax>Fax</OPTION> <OPTION value=Mail>Mail</OPTION></SELECT> <BR></TD></TR> <TR vAlign=top bgColor=#7793ad> <TD class=formtitle align=left width="100%" colSpan=2>Specify Project Information:</TD> </TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>Project Name:</TD> <TD class=formcontent width="100%"><INPUT type="text" size="40" name="Projectname"> <BR></TD></TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>Project Due Date:</TD> <TD class=formcontent width="100%"><INPUT type="text" size="40" name="Duedate"> <BR></TD></TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>Reference #:</TD> <TD class=formcontent width="100%"><INPUT type="text" name="Reference"> <BR></TD></TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>Copies Required:</TD> <TD class=formcontent width="100%"><INPUT type="text" name="Copiesrequired"> <BR></TD></TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>Artwork Provided:</TD> <TD class=formcontent width="100%"><SELECT name="Artworkprovided"> <OPTION value=None selected>None</OPTION> <OPTION value="Online File Transfer">Online File Transfer</OPTION> <OPTION value="On Disk">On Disk</OPTION> <OPTION value="Hard Copy">Hard Copy</OPTION></SELECT> <BR></TD></TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>Flat Size:</TD> <TD class=formcontent width="100%"><SELECT name="Flatsize"> <OPTION value=SelectOne selected>Select One</OPTION> <OPTION value=8.5x11>8.5x11</OPTION> <OPTION value=11x17>11x17</OPTION> <OPTION value=Other>Other</OPTION> </SELECT> <BR></TD></TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>Finished Size:</TD> <TD class=formcontent width="100%"><SELECT name="Finishedsize"> <OPTION value=SelectOne selected>Select One</OPTION> <OPTION value=8.5x11>8.5x11</OPTION> <OPTION value=11x17>11x17</OPTION> <OPTION value=5.5x8.5>5.5x8.5</OPTION> <OPTION value=Custom>Custom</OPTION></SELECT> <BR></TD></TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>Stock For Color Copies:</TD> <TD class=formcontent width="100%"><SELECT name="Stockforcolorcopies"> <OPTION value="Select One" selected>Select One</OPTION> <OPTION value="60lb Laser">60lb Laser</OPTION> <OPTION value="80lb Laser">80lb Laser</OPTION> <OPTION value="32lb Futura Laser ">32lb Futura Laser</OPTION> <OPTION value="60lb Ultra Spec">60lb Ultra Spec</OPTION> <OPTION value="100lb Cardstock">100lb Cardstock</OPTION> <OPTION value="100lb Mega Dull Cover">100lb Mega Dull Cover</OPTION> <OPTION value="80lb Mega Dull Text">80lb Mega Dull Text</OPTION> <OPTION value="10 PT Kromekote">10 PT Kromekote</OPTION></SELECT> <BR></TD></TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>Stock for Black and White Copies:</TD> <TD class=formcontent width="100%"><SELECT name="Stockforbw"> <OPTION value="Select One" selected>Select One</OPTION> <OPTION value="20lb Xerox">20lb Xerox</OPTION> <OPTION value="60lb Opaque">60lb Opaque</OPTION> <OPTION value="70lb Opaque">70lb Opaque</OPTION> <OPTION value="60lb Laser">60lb Laser</OPTION> <OPTION value="80lb Laser">80lb Laser</OPTION></SELECT> <BR></TD></TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>Print Covers On:</TD> <TD class=formcontent width="100%"><SELECT name="Printcoverson"> <OPTION value="Select One" selected>Select One</OPTION> <OPTION value="100lb Cardstock">100lb Cardstock</OPTION> <OPTION value="100lb Mega Dull">100lb Mega Dull</OPTION> <OPTION value="10PT Kromekote">10PT Kromekote</OPTION> <OPTION value="This job does not require covers">This job does not require covers</OPTION></SELECT> <BR></TD></TR> <TR vAlign=top bgColor=#7793ad> <TD class=formtitle align=left width="100%" colSpan=2>Complete This Section for Black and White Copies</TD></TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>Number of Originals:</TD> <TD class=formcontent width="100%"><INPUT type="text" size="40" name="Bworiginals"> <BR></TD></TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>My Originals Are:</TD> <TD class=formcontent width="100%"><SELECT name="Bworiginalsare"> <OPTION value=SelectOne selected>Select One</OPTION> <OPTION value="Single Sided ">Single Sided</OPTION> <OPTION value="Double sided">Double sided</OPTION></SELECT> <BR></TD></TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>Please Print:</TD> <TD class=formcontent width="100%"><SELECT name="Bwprint"> <OPTION value=SelectOne selected>Select One</OPTION> <OPTION value="Single sided">Single sided</OPTION> <OPTION value="Double sided">Double sided</OPTION> <OPTION value=Mixed>Mixed</OPTION></SELECT> <BR></TD></TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>Collate:</TD> <TD class=formcontent width="100%"> <INPUT type=radio value=Yes name=Collatebw>Yes<BR><INPUT type=radio value=No name=Collatebw>No</TD></TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>Additional Information:</TD> <TD class=formcontent width="100%"> <TEXTAREA name="Additionalbw" rows=3 wrap=virtual cols=40></TEXTAREA> <BR></TD></TR> <TR vAlign=top bgColor=#7793ad> <TD class=formtitle align=left width="100%" colSpan=2>FILE SUBMISSION</TD></TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>File Type:</TD> <TD class=formcontent width="100%"><SELECT name="Filetype"> <OPTION value="Select One" selected>Select One</OPTION> <OPTION value="PC ">PC</OPTION> <OPTION value=Macintosh>Macintosh</OPTION></SELECT> <BR></TD></TR> <TR vAlign=top> <TD class=content align=left width="100%" colSpan=2>Click on the "BROWSE BUTTON" to select the "SEND FILE" to transfer your file to us. Please use <a href="http://www.winzip.com/">WINZIP</a> or <a href="http://www.stuffit.com/win/expander/index.html">DROPSTUFF</a>, works better if you compress the file before you send it. </TD> </TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>Application Type:</TD> <TD class=formcontent width="100%"><SELECT name="Applicationtype"> <OPTION value="Select One" selected>Select One</OPTION> <OPTION VALUE="Multiple (Compressed)">Multiple (Compressed) <OPTION VALUE="Acrobat (PDF)">Acrobat (PDF) <OPTION VALUE="CorelDRAW">CorelDRAW <OPTION VALUE="Excel">Excel <OPTION VALUE="Fonts">Fonts <OPTION VALUE="Freehand">Freehand <OPTION VALUE="Illustrator">Illustrator <OPTION VALUE="InDesign">InDesign <OPTION VALUE="Pagemaker">Pagemaker <OPTION VALUE="Photoshop">Photoshop <OPTION VALUE="PowerPoint">PowerPoint <OPTION VALUE="Publisher">Publisher <OPTION VALUE="Word">Word <OPTION VALUE="QuarkXPress">QuarkXPress <OPTION VALUE="Other">Other</SELECT> <BR></TD></TR> <TR vAlign=top> <TD class=formlabel noWrap align=right>File Upload:</TD> <TD class=formcontent width="100%"> <INPUT TYPE="HIDDEN" NAME="MAX_FILE_SIZE" VALUE="900000"> <input name="upload" type="file" size="25"> <BR></TD></TR> <TR> <TD class=formcontent align=middle width="100%" colSpan=2> <HR><input type="submit" name="Submit" value="Send Request"> <INPUT type=reset value=Cancel> </TD></TR></FORM>[/code]here is the php code:[code].secureserver.net', $user = "quoteupload", $pass = "quoteupload") or die("Unable to connect!"); /* change this! */ mysql_select_db("quoteupload") or die("Unable to select database!"); /* change this! */ // EXECUTE QUERY ---> $query="INSERT INTO quoteupload ( Name, Company, Address, Citystzip, Phone, Fax, Email, Responseby, Projectname, Duedate, Reference, Copiesrequired, Artworkprovided, Flatsize,Finishedsize, Stockforcolorcopies, Stockforbw, Printcoverson, Bworiginals, Bworiginalsare, Bwprint, Collatebw, Additionalbw, Colororiginals, Colororigare, Colorprint,Collatecolor, Additionalcolor, Bookletspages, Numberofsets, Printcoveras, Printinsidetxas, Flatsizebooklets, Finishsize, Covers, Printcoversonbooklets, Sigbooksaddinfo,Stcklrgformt, Sizeposter, Lrgfrmtoriginals, Numberofprtforeaorg, Mounting, Laminating, Laminatingfilm, Thicknessfilm, Largeformataddinfo, Mailcontacts, Addresson, Extraline,Contactson, Mailclass, Mailaddinfo, Filetype, Applicationtype) VALUES( '".$Name."', '".$Company."', '".$Address."', '".$Citystzip."', '".$Phone."', '".$Fax."', '".$Email."', '".$Responseby."', '".$Projectname."', '".$Duedate."', '".$Reference."', '".$Copiesrequired."', '".$Artworkprovided."', '".$Flatsize."', '".$Finishedsize."', '".$Stockforcolorcopies."', '".$Stockforbw."', '".$Printcoverson."', '".$Bworiginals."', '".$Bworiginalsare."', '".$Bwprint."', '".$Collatebw."', '".$Additionalbw."', '".$Colororiginals."', '".$Colororigare."', '".$Colorprint."', '".$Collatecolor."', '".$Additionalcolor."', '".$Bookletspages."', '".$Numberofsets."', '".$Printcoveras."', '".$Printinsidetxas."', '".$Flatsizebooklets."', '".$Finishsize."', '".$Covers."', '".$Printcoversonbooklets."', '".$Sigbooksaddinfo."', '".$Stcklrgformt."', '".$Sizeposter."', '".$Lrgfrmtoriginals."', '".$Numberofprtforeaorg."', '".$Mounting."', '".$Laminating."', '".$Laminatingfilm."', '".$Thicknessfilm."', '".$Largeformataddinfo."', '".$Mailcontacts."', '".$Addresson."', '".$Extraline."', '".$Contactson."', '".$Mailclass."', '".$Mailaddinfo."', '".$Filetype."', '".$Applicationtype."')"; //////-----> $result=mysql_query($query) or die("Error in query:".mysql_error()); //if ($result) //echo mysql_affected_rows()." row inserted into the database effectively."; // CLOSE CONNECTION ---> mysql_close($connection); } else{ print "Sorry, but the form cannot be sent until the fields indicated are filled out completely - <br>\n"; print "$error<br>\n"; print "<br>\n"; print "<br>\n"; print "Please use your \"Back\" button to return to the form to correct the omissions. Thank you.<br>\n"; } ?> <?phpinclude ("uploadclass.php"); $upload_class = new FileUpload; $upload_class->temp_file_name = trim($_FILES['upload']['tmp_name']); $upload_class->file_name = trim(strtolower($_FILES['upload']['name'])); $upload_class->upload_dir = "php_uploads/"; $upload_class->upload_log_dir = "php_uploads/upload_logs/"; $upload_class->max_file_size = 5242880; $upload_class->banned_array = array(""); $upload_class->ext_array = array(".zip",".rar",".ace",".tar",".jpg",".gif",".jpeg",".png",".xls",".pdf",".doc",".ppt"); $valid_ext = $upload_class->validate_extension(); $valid_size = $upload_class->validate_size(); $valid_user = $upload_class->validate_user(); $max_size = $upload_class->get_max_size(); $file_size = $upload_class->get_file_size(); $file_exists = $upload_class->existing_file(); if (!$valid_ext) { $result = "The file extension is invalid, please try again!"; } elseif (!$valid_size) { $result = "The file size is invalid, please try again! The maximum file size is: $max_size and your file was: $file_size"; } elseif (!$valid_user) { $result = "You have been banned from uploading to this server."; } elseif ($file_exists) { $result = "This file already exists on the server, please try again."; } else { $upload_file = $upload_class->upload_file_with_validation(); if (!$upload_file) { $result = "Your file could not be uploaded!"; } else { $result = "Your file has been successfully uploaded to the server."; } } echo $result;?>[/code]When I delete the name, address, e-mail form the form the php don't send the e-mail to our clients, how can I pull the info from the login system, thanks. Link to comment https://forums.phpfreaks.com/topic/24722-getting-info-from-mysql-table/ Share on other sites More sharing options...
JasonLewis Posted October 22, 2006 Share Posted October 22, 2006 just you mysql_fetch_array. example:[code=php:0]$user_info = mysql_fetch_array(mysql_query("SELECT * FROM `memberstable` WHERE `username`='".$logged_in_user."'"));[/code]then to grab the users email just do:[code=php:0]echo "An email was sent to ".$user_info['email']." with the information.";[/code]~jay Link to comment https://forums.phpfreaks.com/topic/24722-getting-info-from-mysql-table/#findComment-112583 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.