Reputation: 4 Apprentice
- Active Members
- Active Posts:
- 188 (0.12 per day)
- 18-May 11
- Profile Views:
- Last Active:
- Jul 29 2015 11:52 AM
- Dream Kudos:
Posts I've Made
Makes sense. Thank you for the explanation. I've abandoned this approach in favor of some other less convoluted approach involving Ajax.
$number = "<script>document.writeln(localStorage.getItem('number'));</script>"; //And run the query $query = "SELECT * FROM table WHERE number = '$number' ";
Here $number is a string of JS, nothing else. That JS is not executed or anything so when you put it in the query I am not even sure how you are even getting a number at all. Your query should be reading...
$query = "SELECT * FROM table WHERE number = '<script>document.writeln(localStorage.getItem('number'));</script>' ";
Which is obviously not going to work. PHP can render JS, JS can pass values to other PHP pages via AJAX requests and read in through post parameters, but how you are mixing them here is not making sense. Read my blog about this topic...
Are you perhaps leaving out some steps?
echo $numberjust to make sure and sure enough, I got a '1' printed on the page.
Posted 25 Jul 2015
QuoteThe var_dump yields this:
string(162) "SELECT * FROM table WHERE number = '1 ' "
Well I had to remove some other table columns and associated values from the WHERE clause in the query because I only wanted to include information relevant to the problem. That's why the var dumb string length does not match what I posted.
Posted 12 Jun 2015@artificialsoldier yup that's where the problem stemmed from. I was missing those quotes. So instead of
value = ".$submitted_var."I did
value = '".$submitted_var."'
I'm however thinking that It's much easier and less problematic to just use hidden divs instead of hidden form inputs
Posted 11 Jun 2015Ok thanks that seems to work but the output is a url encoded string. So "hello world" is displayed as "hello+world". I try to use urldecode to get back the original text but it just leaves me with the original problem (trauncated texts).
- Member Title:
- D.I.C Head
- Age Unknown
- Birthday Unknown
- Click here to e-mail me
drayarms hasn't added any friends yet.