/    Sign up×
Community /Pin to ProfileBookmark

Variables into onclick

Hi,

This originates from php but its a javascript issue..

I am using a script to send data to excel, and for each data set I want to create a new sheet. The sheet will be determined by a row from the DB. There is one final sheet called end of report (as you will see below). The issue is that my variables from php are being ignored, there are no errors, but only the end of report sheet is created

`<button onclick=”tablesToExcel(<?php while($create_sheets_row = $create_sheets->fetch()){
$sheet_value = $create_sheets_row[‘area’];`

$sheet_html = “[‘$sheet_value’],”;

`echo $sheet_html; } ?> [‘end of report’], ‘Configuration Management.xls’, ‘Excel’)”>Export to Excel</button>`

What am I missing here?

Thanks

G

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@SempervivumMay 03.2020 — If it's a javascript issue you better post the code created by PHP from the source view of your browser.
Copy linkTweet thisAlerts:
@NachfolgerMay 03.2020 — @genista40#1618067

This is a ABSOLUTE nightmare. Why on earth would you use PHP to echo a parameter into a JavaScript function? Scrap everything you have and try again. It's extremely hard to follow what you're trying to accomplish here.
×

Success!

Help @genista40 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.23,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...