Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
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.

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