Jump to content
• Sign Up

# $_GET url parameter not working in a wizard form? ## Recommended Posts Okay I have index.php in which i used <?php echo$_GET['name']; ?> and its working fine all over the page except a wizard form that loads on a button click.

<?php echo $_GET['name']; ?> is working on entire page text (wherever i have used this) except a wizard form which loads on a button click. All the files of that wizard form are located in my website folder (e.g. wizard.php, wizard.js & wizard.css). here's how wizard.php code starts:  <div class="wizard-container"> <div class="card wizard-card" data-color="green" id="wizardProfile"> <form action=""> <div class="wizard-header"> <h3 class="wizard-title"> GENERATE A FRESH <?php echo$_GET['name']; ?> CODE
</h3>
<h5 style="margin-left: 10px; margin-right: 10px;">Our interactive generator will guide your through the process</h5>
</div>

i want that <?php echo $_GET['name']; ?> should also work in wizard form but it shows the following error: C:\xampp\htdocs\NameGenerator\content\hbox\html\wizard.php on line 7 Sorry for my bad explanation i don't know much about php so i explained it like this Please help... #### Share this post ##### Link to post ##### Share on other sites How are you passing the "name" value to that page? #### Share this post ##### Link to post ##### Share on other sites This usually happens when you do AJAX Calls I am sure when you click on button there is an ajax call to the wizard.php page. The quick solution will be save name attribute to the session from index.php page $_SESSION['name'] = $_GET['name']; when you read name from session on wizard.php page unset the variable from session unset($_SESSION['name']);

Edited by inversesoft123
more information added

#### Share this post

##### Share on other sites
On 9/7/2019 at 12:51 AM, duckygray said:

C😕xampp\htdocs\NameGenerator\content\hbox\html\wizard.php on line 7

That's not the error, that's the file and line on which the error happened - show us the entire message, please.

#### Share this post

##### Share on other sites
On 9/6/2019 at 9:51 PM, duckygray said:

i don't know much about php so i explained it like this

There is some things you need to understand first.

Your PHP server does not magically know $_GET['name'] . It doesn't even save it. Every time your browser accessed the page, it is actually given this data to the server.$_POST is similar.

Go back to your browser, and open the console (F12 for most browsers) and look for a network tab and look what your browser is sending and receiving from the server.  For chrome, sending is Form Data at the bottom of the Headers tab, and receiving is the Response tab.

Now, look at the content sent and retrieved on your wizard request, and you will see that your browser is not sending a value for name.   Therefore, it has no idea what it is.

$_SESSION['name'] is storage. Every time your browser accesses the server, it sends a secret cookie which points to the storage. So you "could" in your normal page where$_GET['name'] is being sent copy this value to a session, and then latter in your wizard script retrieve it, but this is most likely not the intended way to do so.  Just don't try to save the session in your wizard script because obviously it doesn't have the \$_GET['name'].

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×

×

• #### Activity

• Chat
×
• Create New...

## Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.