Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

TheGarden's avatar

Sending URL Query String through Vue / Axios

I'm pretty new to Vue / Axios.

What I'm trying to do is get and send the query string through to an email using Axios. The Query string is set from Google Adwords.

The current PHP way is

<input type="hidden" id="keyword" name="keyword" value="<?php echo $keyword; ?>">

http://website.co.uk/page.php?keyword=jh%20page&gclid=XXIaIZobFhEInb6zoDyH3AIViwDTCh1yawIPFYTAYASRAEgIJH_D_BwE

My current vue code

    const app = new Vue({
        el: '#app',
        data() {
            return {
                step: 1,
                activeButton: {},
                counter: 0,
                buttons: [{
                    value: 1,
                    from: '£3,000',
                    to: 'TO £5,000'
                }, {
                    value: 2,
                    from: '£5,000',
                    to: 'TO £10,000'
                }, {
                    value: 3,
                    from: 'OVER',
                    to: '£10,0000'
                }],
                debt: {
                    name: null,
                    email: null,
                    tel: null
                }
            }
        },
        methods: {
            prev() {
                this.step--;
            },
            next() {
                this.step++;
            },
            onClick(button) {
                this.activeButton = button;
                this.counter = button.value;
            },
            submit() {
                axios.post('post.php', {
                    'name': this.debt.name,
                    'email': this.debt.email,
                    'tel': this.debt.tel,
                    'from': this.activeButton.from,
                    'to': this.activeButton.to,
                }).then(response => {
                    console.log('success', response.data.message)
                }).catch(error => {
                    console.log(error.response)
                });
            }
        }
    });

Hopefully, someone can help push me in the right direction. Please let me know if you need any other information.

Thanks, J.

0 likes
0 replies

Please or to participate in this conversation.