PHP Developers Network

A community of PHP developers offering assistance, advice, discussion, and friendship.
 
Loading
It is currently Mon Jan 20, 2020 3:27 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: What is this error???
PostPosted: Fri Apr 19, 2002 8:53 am 
Offline
Forum Commoner

Joined: Fri Apr 19, 2002 8:53 am
Posts: 86
Location: Canada


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 19, 2002 10:03 am 
Offline
Site Admin

Joined: Thu Apr 18, 2002 3:14 pm
Posts: 1767
Location: Montreal, CA


Top
 Profile  
 
 Post subject: OK
PostPosted: Fri Apr 19, 2002 10:07 am 
Offline
Forum Commoner

Joined: Fri Apr 19, 2002 8:53 am
Posts: 86
Location: Canada


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 19, 2002 10:21 am 
Offline
Site Admin

Joined: Thu Apr 18, 2002 3:14 pm
Posts: 1767
Location: Montreal, CA


Top
 Profile  
 
 Post subject: well
PostPosted: Fri Apr 19, 2002 10:38 am 
Offline
Forum Commoner

Joined: Fri Apr 19, 2002 8:53 am
Posts: 86
Location: Canada
I tried to create a var $one = 1; at the top and then use that instead of 1, but it gave the same response, thanks for trying.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 19, 2002 10:52 am 
Offline
Site Admin

Joined: Thu Apr 18, 2002 3:14 pm
Posts: 1767
Location: Montreal, CA


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 19, 2002 10:57 am 
Offline
Site Admin
User avatar

Joined: Fri Apr 19, 2002 9:49 am
Posts: 139
Location: Missouri, USA


Top
 Profile  
 
 Post subject: whew
PostPosted: Fri Apr 19, 2002 11:02 am 
Offline
Forum Commoner

Joined: Fri Apr 19, 2002 8:53 am
Posts: 86
Location: Canada


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 19, 2002 4:14 pm 
Offline
Forum Commoner

Joined: Thu Apr 18, 2002 3:59 pm
Posts: 84


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 19, 2002 4:22 pm 
Offline
Forum Commoner

Joined: Thu Apr 18, 2002 3:13 pm
Posts: 37
Hey I recognise that ;)

I think I was helping out with this code before the server move - and the action variable was the problem (but not on my machine)

action is working in a query string and returns a function, I think the problem may be in the code I initially gave - it was a quick example - but if you are still using the same setup try changing

<form method="post" action="?action=submitC">

remove action="?action=submitC

and add this into your form

<input type="hidden" name="action" value="submitC">

I dunno if this will sort you out, but it would be the next thing I try.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 19, 2002 4:23 pm 
Offline
Forum Contributor
User avatar

Joined: Thu Apr 18, 2002 11:11 pm
Posts: 217
Location: Northern California


Top
 Profile  
 
 Post subject: nope,
PostPosted: Mon Apr 22, 2002 9:32 am 
Offline
Forum Commoner

Joined: Fri Apr 19, 2002 8:53 am
Posts: 86
Location: Canada
That didn't work. here is my complete code:

<html>
<body>
<form method="post" action=submitC">


Please complete the following 3 questions
<p><p>

<BR>How many times have you visited this site including today?<BR>
<input type=radio name=choice value=1>1-5<BR>
<input type=radio name=choice value=2>6-15<BR>
<input type=radio name=choice value=3>16-30<BR>
<input type=radio name=choice value=4>31+<BR>

<BR>Did you find what you were looking for on the site?<BR>
<input type=radio name=choice2 value=1>Yes<BR>
<input type=radio name=choice2 value=2>No<BR>

<BR>Would you like the site to remain online?<BR>
<input type=radio name=choice3 value=1>Yes<BR>
<input type=radio name=choice3 value=2>No<BR><BR>
<div align="left"><input type="Submit" name="Submit" value="Submit">
</form>
</body>
</html>

<?php
//VARIABLES
$visits = array ("1", "2-15", "16-30", "31+");
$find = array ("Yes", "No");
$keep = array("Yes","No");
$num = 0;
$num2 = 0;
//END VARIABLES

function submitClick($choice,$choice2,$choice3,$action){
if ($choice == 1){
echo "1-5, ";
$num = 1;
}
elseif ($choice == 2){
echo "6-15, ";
$num = 2;
}
elseif ($choice == 3){
echo "16-30, ";
$num = 3;
}
elseif ($choice == 4){
echo "30+, ";
$num = 4;
}
else{
$num = 0;
}

if ($choice2 == 1){
echo "yes, ";
$num2 = 1;
}
elseif ($choice2 == 2){
echo "no, ";
$num2 = 2;
}
else{
$num2 = 0;
}

if ($choice3 == 1){
echo "yes";
$num3 = 1;
}
elseif ($choice3 == 2){
echo "no";
$num3 = 2;
}
else{
$num3 = 0;
}

$fp = fopen ("file.txt", "a");
$wri = fwrite($fp,$num);
$wri = fwrite($fp,$num2);
$wri = fwrite($fp,$num3);

fclose($fp);
}

if ($action=="submitC" ){
submitClick($choice,$choice2,$choice3,$action);
}
?>

it just keeps saying:

Warning: Undefined variable: action in \php\firstphp.php on line 89

this is my major problem, if anyone solves it, i will be in their debt :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 22, 2002 10:38 am 
Offline
Site Admin
User avatar

Joined: Fri Apr 19, 2002 8:29 am
Posts: 175
Location: Dallas, Tx
That's just a warning because you didn't declare the variable before you used it.


Top
 Profile  
 
 Post subject: but
PostPosted: Mon Apr 22, 2002 10:42 am 
Offline
Forum Commoner

Joined: Fri Apr 19, 2002 8:53 am
Posts: 86
Location: Canada
I tried to declare it before, but then nothing happens when I click my button, it only works if I don't declare it. Will the warning show up to the general user ?? How do I declare it and get it to work because like I said, it doesn't work when I declare $action..


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 22, 2002 10:46 am 
Offline
Site Admin
User avatar

Joined: Fri Apr 19, 2002 8:29 am
Posts: 175
Location: Dallas, Tx
well, sounds like you have bigger issues than that, but if you change the error reporting level for the script, then it wont show that Warning.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group