And put commas. :)
Edit: I didn't see shawnCplus edit his post!
And put commas. :)
Edit: I didn't see shawnCplus edit his post!
You bumped into a 2.5 yr old thread :) !
The problem is with the file db.php . When you are using header() function, you shouldn't output anything to the browser. ie., you shouldn't echo anything before header function. You shouldn't even have html tags. Check your db.php.
Cheers,
Nav
huh! Right click on your page and click on view source. Check if the value for <option value=''> is being set. Check if its not null. Then select some dropdown list values and check again. When you submit, if you get something like, array([priceisright]=>your choice,......) , then your code has no problem!
:) Welcome!
Hey! Welcome to Daniweb!
Welcome!
I have no idea what's on line number 2 of your script. (And, I am not a mind reader.)
my code works just fine :)
You need to show us your entire script. :)
Yes, you can. But make sure you are connecting to the database before executing any query.
<?php
$file="test.xls";
$test="<table border=1><tr><td>Cell 1</td><td>Cell 2</td></tr></table>";
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$file");
echo $test;
?>
This works.
Weird. This script is running fine on my system. Print out the message! I get,
Thank you for registering with our site! Your selection was naveen2. Sincerely, Us
. Also check if you are populating the dropdown list! Or, I think you probably selected either "Please Choose One Person" or "Not Voting". Assign some value to these options and test.
Well, you need to post your script then.
comment out mail(...) line in your script and on top of the script, right after <?php put this line. print_r($_POST); Then fill out the form once again, click on submit. Check If any value assigned to .
ok..Then the problem is not with smtp.. Check if $_POST is sending a value.
Try out a sample mail first to your own id. If you get it, then the problem is with your script. If you dont get a mail, then probably, your smtp is not configured properly.
Yep. What you have done is correct.
$x=$_POST['field1'];
$y=$_POST['field2'];
$z=$_POST['field3'];
....
//In case you want to concat them, you can do it this way.
$string = $x." ".$y." ".$z; //This will concat all the three variables separated by a space.
...
:) Hope that helps.
no problemo! :)
Instead of {$_POST}, you can assign that to a variable and use that variable. Its little confusing for starters on how php handles strings.
// Mail Script
if(isset($_POST['submit'])){
$selection=$_POST['style'];
$message = "Thank you for registering with our site!\nYour selection was $selection.\n\nSincerely,\nUs";
mail("****@anblickstudios.com","Grad Survey 08",$message,"from: *****@anblickstudios.com");
}
?>
You can do that.
Cool people are most of the times stupid!
Where did you get this script from ? Its incomplete. I hope you know the basics of sql(select, insert, update and delete). Check this below script. Enter the details and click on submit. On top, it shows all the form data that has been sent. Populating a dropdown box is not a difficult thing.
<?php print_r($_POST); ?>
<HTML>
<head>
<title>Chained Selects</title>
<script language="javascript" src="chainedmenu.js">
/***********************************************
* Chained Select Menu- By Xin Yang (http://www.yxscripts.com/) Dynamic
Drive (http://dynamicdrive.com)
* Script featured on/available at http://www.dynamicdrive.com/
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
* This notice must stay intact for legal use!
***********************************************/
</script>
<script language="javascript" src="config.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><style type="text/css">
<!--
body {
background-image: url(electronics.gif);
background-repeat: repeat;
}
.style5 {
color: #000080;
font-size: 18px;
}
.style6 {color: #000080; font-size: 36px;}
.style7 {color: #000080; font-size: 18px; font-weight: bold; }
.style8 {font-size: 40px}
-->
</style></head>
<BODY TEXT="GREEN" LINK="BLUE" ALINK="LIGHTGREEN" VLINK="DARKGREEN"
bgcolor="beige">
<body onload="initListGroup('chainedmenu', document.listmenu0.firstlevel,
document.listmenu0.secondlevel, document.listmenu0.thirdlevel,
'savestate')">
<H1 ALIGN="center" class="style6"><span class="style8">DJ Electronics Brown Goods Portal</span><br>
<br>
<br>
</H1>
<FORM action="test.php" method="post" name="listmenu0">
<P ALIGN="left">
<div align="left">
<table>
<td class="style5">
<LABEL for="database"><strong>Product Database:</strong> </LABEL>
<INPUT type="text" name="database" value="incoming" readonly> </td>
<td class="style5">
<LABEL for="client" class="style7">Client: </LABEL>
<select name="client">
<option value="Amerge" >Amerge</option>
<option value="Base" >Base</option>
<option value="BigW" >Big W</option>
<option value="Buy'N'Save" >Buy'N'Save</option>
<option value="Daewoo" >Daewoo</option>
<option value="DJ Electronics" >DJ Electronics</option>
<option value="LG" >LG Electronics</option>
<option value="Mistral" selected>Mistral</option>
<option value="Myer" >Myer</option>
<option value="Omni" >Omni</option>
<option value="PYE" >PYE</option>
<option value="Sonashi" >Sonashi</option>
<option value="Sunfire" >Sunfire</option>
<option value="Supacity" …
Revenge of the Sith is a very boring movie.
You are welcome! :)
Umm.. You can have 3 tables. One to store all the registration information. Second to store the login information and third, to store the path of the files for every user. In registration table, you can have firstname, lastname, loginname, password, confirmpassword, email, blah blah blah. This will only be used when a new user registers or to retrieve the email of an already registered user(Eg. for forgot password). Login table has fields like id, loginname, password, last_login,status etc. A record is inserted to this table when a new user registers. Whenever the user enters his username and password, you can validate it using this table. The third table would store the path of the file of that user, id (of table login) being the foreign key.
The number of function depends on the coder. Some write 20 functions for an application, while some write only 5.
Security depends on how you write your scripts. Escaping special characters, using stored procedures, etc will make your application more secure.
You can check sourceforge.net for a sample application.
Cheers,
Naveen
Simple. You do it this way.
<?php
.....
if($row_rsFrontPage['ImagePath']=="") {
$class="noclass";
} else {
$class="applyclass";
}
?>
<p class="<?php echo $class; ?>">blah blah blah... </p>
Hope that helps.
Naveen
On submitting the page, if the user has selected a value from the select box, it will be in $_POST. So, you can do something like $x=$_POST. $x will have his selection.
Wow! interesting. Welcome to Daniweb Vanguns!
To create the usp_InsertGroup stored procedure, right-click the Stored Procedures node and choose New Stored Procedure or click the Database menu and choose New Stored Procedure. Enter the following code: SQL Server CREATE PROCEDURE usp_InsertGroup ( @GroupID UNIQUEIDENTIFIER, @GroupName VARCHAR(50), @GroupDescription TEXT ) AS INSERT INTO Groups (GroupID, GroupName, GroupDescription, LastUpdateDate) VALUES(@GroupID, @GroupName, @GroupDescription, GETDATE())
Source: http://www.wrox.com/WileyCDA/Section/id-107160.html
:?:
what do the square-brackets in your procedure name do?
Its an optional field which specifies the owner of that procedure, followed by procedure name.
Source: http://msdn2.microsoft.com/en-us/library/aa258259(SQL.80).aspx
:(
LOL.. i know.. you have already given me reps for a php question(and you can give reps only once per day!)
:@ I want my reps! lol..
You are welcome ;)
SELECT eid, title, SUBSTRING(content, 1, 200), thumb_image FROM diary ORDER BY eid DESC LIMIT 3
:) Now, gimme my virtual high five!
Sorry dude! I don't know :(
umm.. I am not much sure about the procedure you are using. But I use something like this.
CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_addcategory`(IN categoryid INT,IN published TINYINT,IN categoryname VARCHAR(60),IN contents TEXT)
BEGIN
insert into category (ct_name,ct_published,ct_description) values (categoryname,published,contents);
END
If you are inserting a string to a table, you have to use single quotes around it. Eg. insert into tablename (varchar_field,int_field) VALUES ('this is a test',3);
That might be causing the problem at this line.
Insert into tblGroupState(DiskFileName, FileState)
Values (@FileName, @State);
So, what are you looking for ? An error in your code or the datatype ? :s
In mysql, we dont have adVarChar! Its either char, varchar or text.
$query = "INSERT INTO repairs (date, client, model, batch, chassis, serial, fault, prefault, remedy, status, remote, soak, job_type, tech) VALUES (".'"'.$d$
and
$query = "SELECT id, client, model, batch, chassis, fault, prefault, remedy, status, soak, tech FROM repairs WHERE date=".'"'.$date.'"'." AND job_type=".'"'$
and
print "<table border=1><tr><th>id</th><th>Client</th><th>Model</th><th>Batch</th><th>Chassis</th><th>Fault</th><th>Existing Fault</th><th>Remedy</th><th>Sta$
is not closed.
The query should be something like this, $query="INSERT INTO TABLENAME (COL1,COL2,COL3,COL4) VALUES ('VAL1','VAL2','VAL3','VAL4')";
:)
This is the page for the user input. Show us addrecord1.php. And, if you have the action file in the same folder, its not required to give the whole path (/query/addrecord1.php). You can directly give addrecord1.php. Please show us addrecord1.php. And, please, while posting your code, put it within [/code ] tags. :)[code ] [/code ] tags. :)
Welcome to Daniweb! Can you show us your script so that we can make out where you are going wrong ?
$result=mysql_query($query);
$found=mysql_num_rows($result);
if($found > 0 ){
echo "Record found";
} else {
echo "Record not found.";
}
That will do.
Welcome!