Naming an option

Links for php scripts

Moderators: egami, macek, gesf

Post Reply
LabourSoft
New php-forum User
New php-forum User
Posts: 11
Joined: Sat Jul 04, 2015 9:50 pm

Thu May 04, 2017 11:07 am

Hi there,

I have the following code

Code: Select all

<?php
<form method="post" action="index.php">

    echo "<select>";
        $xml = simplexml_load_file('CustXML.xml');
            foreach ($xml->CustXML as $CustXML)
				{
				echo "<option name='SelStore' value='".$CustXML->Store."'>" . $CustXML->Store . "</option>";
				}
    echo "</select>";
?>

<input type="submit" name="submitstore" value="Submit" />
But when I try to use the option result later on it doesn't seem to recognise the name I have it - see below

Code: Select all

if(isset($_POST['submitstore'])){
		echo $_POST['SelStore'];
        exit;
}
Do I name the option correctly?

Thanks a lot

AdoptiveSolution
New php-forum User
New php-forum User
Posts: 163
Joined: Wed Jun 15, 2016 8:35 am

Thu May 04, 2017 12:29 pm

Try this :

Code: Select all

<select name='SelStore'>
Info :

https://www.w3schools.com/tags/att_select_name.asp

LabourSoft
New php-forum User
New php-forum User
Posts: 11
Joined: Sat Jul 04, 2015 9:50 pm

Thu May 04, 2017 10:10 pm

@AdoptiveSolution - Ahhh - thanks a lot!!!

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest