Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

script works for me but not for someone else

Status
Not open for further replies.

elck

Programmer
Apr 19, 2004
176
NL
There have been many post on supplying variables to php and I think I understand the concept.

My script is simply a form that supplies data to Mysql.
It always works well at my pc, and only sometimes works at my clients computer.

It drives me mad.

I tried import_request_variables(),
I tried to GET and to PUT
I tried $_GET['name']
I have the program send me an email with the variables

From the emails I can see that often the external variables are empty.

My client uses IExplorer as do I, same make.

What else can I try???


 
Can we see the code you've tried? And that of the form?

BTW, it's not PUT it's $_POST.

Ken
 
Of course Post, not put, that was a typo.

There is a lot that is absolutely irrelevant in the script so I will have to strip the file first.
I thought maybe someone had encountered something simular and could give me some tips to try.

I will produce a stripped file shortly, in the meanwhile any sugestions?
 
Code:
<SCRIPT LANGUAGE="JavaScript">
<!--
function MyDelete(a) {
	g=document.getElementById("X" + a);
	g.value="1";
	f=document.getElementById("Z" + a);
	f.submit();
}
//-->
</SCRIPT>

<?php
$query="SELECT * FROM `db` WHERE `rubriek`='$soort' ORDER BY `id` DESC ";
$result=mysql_query($query);
			while ($line=mysql_fetch_array($result,MYSQL_ASSOC))
				{
					$data[]=$line;
						}

foreach ($data as $d) 
		{
		print "<form method=\"get\" action=\"schrijf.php\" id=\"Z" .  $d['id']  . "\">\n\n";
		print "		<input type=\"text\" value=\"" . $d['text'] . "\" name=\"tekst\"><br>\n\n";
		print "		<input type=\"hidden\" name=\"delet\" value=\"0\" id=\"X" .  $d['id']  . "\"><br>\n\n";
		print "		<a href=javascript:MyDelete(\"" . $d['id'] . "\")>delete</a>\n\n";
		print "		<input type=\"submit\" ><br>\n\n";
		print "</form>\n\n";
		}
?>
Just an example.
There is no different result when submitted by javascript or through pressing the submit button in that both sometimes result in no data at all.
As said I tried POST as well.

In the schrijf.php receiving script I tried:
import_request_variables("GP");
$tekst1=$_GET['tekst'];
$tekst1=$_POST['tekst'];
etc.

Again, on my computer and on many others it all works fine, but at my clients' it sometimes doesn't, which I test by having the schrijf.php script mail the variables back to me.

I suspect a virus or pop-up at my clients end, or could it be his provider, cache or???


 
OK, let's start by cleaning up your code to get rid of the escaped double quotes which make the source difficult to read:
Code:
<?php
$query="SELECT * FROM `db` WHERE `rubriek`='$soort' ORDER BY `id` DESC ";
$result=mysql_query($query);
while ($line=mysql_fetch_assoc($result))
   {
   echo '<form method="get" action="schrijf.php" id="Z' .  $line['id']  . '">'."\n\n";
   echo "\t".'<input type="text" value="' . $line['text'] . '" name="tekst"><br>'."\n\n";
   echo "\t".'<input type="hidden" name="delet" value="0" id="X' .  $line['id']  . '"><br>'."\n\n";
   echo "\t".'<a href=javascript:MyDelete("' . $line['id'] . '")>delete</a>'."\n\n";
   echo "\t".'<input type="submit"><br>'."\n\n";
   echo '</form>'."\n\n";
   }
?>
I also cleaned up your "while" loop by getting the info directly from the retrieved line.

In your script "schrijf.php", dump the $_GET superarray
Code:
<?
echo '<pre>';print_r($_GET);echo '</pre>';
?>
Also on your client's machine take a look a the generated source code to make sure it is being generated correctly.

Ken
 
I do not have easy access to my clients machine so I cannot dump the array, but mailed to variables back to me. More or less the same thing. I also mailed the request_uri back to me, an advantage of GET over POST in this case. It looked something like this:

Code:
request uri : /edit/schrijf.php?kop=test+nieuw&omschrijving=en+nu&prijs=100&nummer=8&soort=3&foto=&check=1&toon=1&voegtoe=1

(You see that the real program has more fields)

But sometimes the request uri comes back empty.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top