check if button is pressed

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

gerhardt
New php-forum User
New php-forum User
Posts: 6
Joined: Wed Jul 16, 2003 10:49 pm

check if button is pressed

Postby gerhardt » Thu Jul 17, 2003 11:24 pm

Hey
I have a little problem. I wrote a code where when somebody presses a button my program is supposed to write something into a DB. But I cannot get it to work. Below is the code I uses so far.

$download = "<form name=\"link\" method=\"get\" action=\"$content_ID[0]\" onSubmit=\"return valid(this)\">
<input type=\"image\" src=\"../images/download.gif\" width=\"120\" height=\"21\" border=\"0\" alt=\"Submit\" name=\"Submit\" value=\"test\"/></form>";
echo "$download";

if(!empty($Submit)){
$query1 = &$conn -> Execute("INSERT INTO $Track (user_id, date, course_id) VALUES ('$u_name', NOW(), '$id')");
}

It is not going to execute the query. Does anybody has any idea what could be the problem?
Thanx a lot
YOGI

User avatar
Skeletor
New php-forum User
New php-forum User
Posts: 147
Joined: Tue Nov 19, 2002 7:47 am
Location: US, Ohio
Contact:

Postby Skeletor » Fri Jul 18, 2003 3:43 am

One thing to check for is to see if you have globals turned on. Try referring to your submit button as $_REQUEST['Submit'].

if(!empty($_REQUEST['Submit'])) {

gerhardt
New php-forum User
New php-forum User
Posts: 6
Joined: Wed Jul 16, 2003 10:49 pm

Postby gerhardt » Sat Jul 19, 2003 5:31 am

Thanx for the answer. I changed it but it still does not work. The variable is never filled it is always empty. What could I do to change this. Thanx for the help..

YOGI

User avatar
Joan Garnet
Moderator
Moderator
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars
Contact:

Postby Joan Garnet » Sat Jul 19, 2003 6:03 am

Try this:

Code: Select all

if( isset ( $_GET["Submit"] ) ){


Return to “PHP coding => General”

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

cron