Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Server-side Scripting _ Undefined variable

Posted by: tudsy Mar 27 2017, 01:04 AM

Hi

I am having trouble with in trying to find out why this error is happening.
I have looked at the error log and it points to lines 50 and 52 in processmiddlepage.php.

I have attached the calling program ecovib2d1.php and processmiddlepage.php .

Any help will be greatly appreciated.


Thanks.


Attached File(s)
Attached File  ecovib2d1.php ( 10.57k ) Number of downloads: 482
Attached File  processmiddlepage.php ( 2.26k ) Number of downloads: 479

Posted by: CharlesEF Mar 27 2017, 01:52 PM

Well, seems to be exactly what the error message says. What really surprises me is that I pointed out this error before. Your query string is malformed (invalid). There should be a 'name=value' pair for each query item but this is your link:

CODE
document.getElementById('form').action='https://103.226.223.161/~ecovibdc/ECOVIB2D/MYART/processmiddlepage.php?username&email&Person =' + personname + '&Price =' + Priceofart + '&Graphic =' + picname.replace('w.bmp','.bmp');

Look at username & email. It should be 'username=some_value' and 'email=some_value'

Posted by: CharlesEF Mar 27 2017, 07:45 PM

Ok, I have to ask this. Here is a function from processmiddlepage.php:

CODE
  <script>
  
function layout(){
  
  
<?php

$name = $_GET['username'];
$email = $_GET['email'];

?>


Price = <?php echo $_GET['Price']?>;
document.getElementById('price').innerHTML='Price (USD) $' + Price + 'including GST       CVV:';
Graphic = <?php echo $_GET['Graphic']?>;
document.getElementById('graphic').innerHTML='Graphic:' + Graphic  + '               Expiry: (mm\yy)';

};

</script>
.
What is your reasoning for the block of PHP code ('$name = ' and '$email = ') inside the Javascript function?

Posted by: tudsy Mar 27 2017, 11:21 PM

Hi

Thanks for that.

I fixed the block of php code. smile.gif

Now, I was wondering what is wrong with this query string?



document.getElementById('form').action="http://103.226.223.161/~ecovibdc/ECOVIB2D/MYART/processmiddlepage.php?username1=username&email1=email&Person=" + personsnamejs + "&Price=" + Priceofart + "&Graphic=" + picname.replace('w.bmp','.bmp');


Thanks.

Posted by: CharlesEF Mar 28 2017, 11:28 AM

'?username1=username&email1=email', where do the values username and email come from? Are they Javascript or PHP variables? The last time I asked this question you said they were PHP variables. I showed you how to echo the PHP variables into the Javascript query.

Once again I ask a question and I get nothing back from you. I ask these question for a reason. Based on the code I see you still don't understand server vs client side processing. You use WAY to much Javascript and not nearly enough PHP. You wouldn't need so much Javascript if you used PHP better.

Posted by: tudsy Mar 29 2017, 04:47 AM

QUOTE(CharlesEF @ Mar 29 2017, 01:58 AM) *

'?username1=username&email1=email', where do the values username and email come from? Are they Javascript or PHP variables? The last time I asked this question you said they were PHP variables. I showed you how to echo the PHP variables into the Javascript query.

Once again I ask a question and I get nothing back from you. I ask these question for a reason. Based on the code I see you still don't understand server vs client side processing. You use WAY to much Javascript and not nearly enough PHP. You wouldn't need so much Javascript if you used PHP better.


Hi

Thanks for that.

It was a silly oversight.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)