Jump to content

undefined index:


Magestickown

Recommended Posts

Please help me, I keep getting undefined index

 

Here's my code:

 

<?php

//////////////////

 

if ($_GET['formradio1']=='') <--- Line 179

{

?>

<html>

<div id="image1" style="position:absolute; overflow:hidden; left:0px; top:495px; width:658px; height:500px; z-index:0"><img src="images/default.jpg" alt="" title="" border=0 width=658 height=500></div>

<left>

</html>

<?php

}

 

 

if ($_GET['formradio1']=='HTR') <----- Line 190

{

?>

<html>

<div id="image2" style="position:absolute; overflow:hidden; left:0px; top:495px; width:658px; height:500px; z-index:1"><img src="images/htr.jpg" alt="" title="" border=0 width=658 height=500></div>

<left>

</html>

<?php

}

 

///////////////////////////

 

if ($_GET['formradio1']=='faq') <------ Line 202

{

?>

<html>

<div id="image2" style="position:absolute; overflow:hidden; left:0px; top:495px; width:658px; height:500px; z-index:1"><img src="images/faq.jpg" alt="" title="" border=0 width=658 height=500></div>

<left>

</html>

<?php

}

 

///////////////////////////

 

if ($_GET['formradio1']=='bridge') <------ Line 214

{

?>

<html>

<div id="image2" style="position:absolute; overflow:hidden; left:0px; top:495px; width:658px; height:500px; z-index:1"><img src="images/bridge.jpg" alt="" title="" border=0 width=658 height=500></div>

<left>

</html>

<?php

}

 

 

//////////

?>

 

 

And my error:

 

 

Notice: Undefined index: formradio1 in C:\wamp\www\help.php on line 179

 

Notice: Undefined index: formradio1 in C:\wamp\www\help.php on line 190

 

Notice: Undefined index: formradio1 in C:\wamp\www\help.php on line 202

 

Notice: Undefined index: formradio1 in C:\wamp\www\help.php on line 214

 

The name of my radio button is fromradio1 - How would I make it a defined index to load the image? :(

Link to comment
https://forums.phpfreaks.com/topic/191227-undefined-index/
Share on other sites

if (empty($_GET['formradio1'])) {
// ...
}
else if ($_GET['formradio1'] == 'foo') {
// ...
}
else if ($_GET['formradio1'] == 'bar') {
// ...
}
// ...
else { // something else
// ...
}

 

Or using a switch:

if (empty($_GET['formradio1'])) {
// ...
}
else {
switch($_GET['formradio1']) {
	case 'foo':
		// ...
		break;
	case 'bar':
		// ...
		break;
	default:
		// ...
		break;
}
}

Link to comment
https://forums.phpfreaks.com/topic/191227-undefined-index/#findComment-1008279
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.