pedrobcabral Posted January 14, 2007 Share Posted January 14, 2007 I have a form with get method. My variable ID is assigned to 1 in the url.The code:[code] <?php$calculate = $_GET[id]+1;echo "Calculation is: $calculate";[/code]Gives me the output: Calculation is 1+1 instead of Calculation is 2.Could you help me? Thank you. Link to comment https://forums.phpfreaks.com/topic/34128-11/ Share on other sites More sharing options...
mattd8752 Posted January 14, 2007 Share Posted January 14, 2007 $calculate = $get['id']+1;echo ...the rest of the code. I think the quotes might fix it. If not you can always include$calculate++ I belive. That may be wrong though in the second version. Link to comment https://forums.phpfreaks.com/topic/34128-11/#findComment-160534 Share on other sites More sharing options...
kenrbnsn Posted January 14, 2007 Share Posted January 14, 2007 This code works for me:[code]<?php<?phpif (isset($_GET['id'])) { $calculate = $_GET['id'] + 1; echo $calculate . '<br>';}?><form>Id: <input type="text" name="id"> <input type="submit" name="submit"></form>[/code]Ken Link to comment https://forums.phpfreaks.com/topic/34128-11/#findComment-160536 Share on other sites More sharing options...
pedrobcabral Posted January 14, 2007 Author Share Posted January 14, 2007 Right, thank you. Link to comment https://forums.phpfreaks.com/topic/34128-11/#findComment-160540 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.